Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

ajax call do something while

$('#loading').show() //show spinner
$.ajax({
    url: '/path/to/file',
    type: 'GET',
    data: {param1: 'value1'},
})
.done(function() {
    console.log("success");
})
.fail(function() {
    console.log("error");
})
.always(function() {
    console.log("complete");
    $('#loading').hide();//hide your spinner here!!
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ajax #call
ADD COMMENT
Topic
Name
7+3 =