adib16
adib16

Reputation: 1697

get status in sending data to server with jquery

I use this code for sending form to the server with $.post() function.

$.post('filepath' , {fname:fname , lname:lname} ).done(function(data){
   $('#status').html('finished');
});

I want show the user a messege while sending the data to the server.done() is for finished progress. is there any way for while sending the data??

Upvotes: 0

Views: 45

Answers (1)

aksu
aksu

Reputation: 5235

You can try

$('#status').html('Processing...');
$.post('filepath' , {fname:fname , lname:lname} ).done(function(data){
   $('#status').html('finished');
});

Edit:

$(document).on("ajaxStart", function(){
   $("#status").html('Processing...');
});

Find more on http://api.jquery.com/Ajax_Events/

Upvotes: 2

Related Questions