How to determine if the `.post` request has been started and finish in jquery -


is there way on how can determine if .post request has started , finished.

i mean, if have code:

$.post('address.php', { value: value }, function(data) {     alert(data);     }); 

how can know started me show loading image , hide loading image upon completion of said .post request.

i know there way on how make done because, websites using kind of algorithm. , want write in jquery.

any inputs?

the request initiated immediately, can show loader before call $.post().

calling $.post() return promise, can this:

// show loader $("#myloader").show()  $.post('address.php', { value: value }, function(data) {     alert(data); }) .always(function() {      // hide again when request complete     $("#myloader").hide(); }); 

this documented in jquery api documentation of $.post().


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -