How to automatically load a certain webpage content with Ajax and jQuery when page is first loaded?

When opening my webpage none of the Ajax content loads until one of the links is clicked then displaying the content connected to that link. This is where the content is loaded into the main webpage at ext-content: <main> <article class="ext-content"> </article> </main> This is the javascript which loads the content when one of the… Read More How to automatically load a certain webpage content with Ajax and jQuery when page is first loaded?

sending multiple data ajax

I want to send the data which is in the variable "blog_id" to the page "blog_img_upload.php" along with the "form_data" Please help. The codes are in below – var blog_id = "<?php echo"$blog_id"?>"; let form_data = new FormData(); let img = $("#myImage")[0].files; if(img.length > 0){ form_data.append(‘my_image’, img[0]); $.ajax({ url: ‘blog_img_upload.php’, type: ‘post’, data: form_data, //data:{… Read More sending multiple data ajax

Ajax post data don't arrive to Django

I am developing a Django application. I am trying using jquery and ajax for a POST request but I am not able to find the error. I am basically struggling to send the data from the frontend with ajax to the server. views.py def add_new_question_feedback(request, pk): if request.headers.get(‘x-requested-with’) == ‘XMLHttpRequest’: question = Question.objects.get(id=pk) feedback =… Read More Ajax post data don't arrive to Django

Textarea value not resetting in post action with Ajax

I’m using PHP and Ajax to post without page refresh. Everything works fine but the textarea content is not reset after submitting the form. This is my Ajax code: $("#new_post__add").submit(function(event){ event.preventDefault(); var post_url = $(this).attr("action"); var request_method = $(this).attr("method"); var form_data = $(this).serialize(); $.ajax({ url : post_url, type: request_method, data : form_data }).done(function(response){ // $("#load_data").html(response);… Read More Textarea value not resetting in post action with Ajax

How can I submit a form click a span element while I want to use ajax in form to prevent refreshing and also want to keep submit button for responsive

As from the title, I want to submit a form by click a span element. I also want to prevent the page from refreshing. I also want to add normal submit button for mobile view. But on submit won’t work unless I directly submit the form. Is there a way to submit the form with… Read More How can I submit a form click a span element while I want to use ajax in form to prevent refreshing and also want to keep submit button for responsive