Search
 
SCRIPT & CODE EXAMPLE
 

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!!
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: splidejs example 
Javascript :: use thymeleaf variable in javascript 
Javascript :: TypeError: MiniCssExtractPlugin is not a constructor 
Javascript :: set background opacity react native 
Javascript :: split date in javascript 
Javascript :: javascript reduce array of objects 
Javascript :: how to copy to clipboard in react js 
Javascript :: Append element to a different parent 
Javascript :: how to sum two var in jquery 
Javascript :: javascript ascending and descending 
Javascript :: how to find the last object in an array 
Javascript :: js filter undefined from array 
Javascript :: javascript recursive sum function 
Javascript :: csrf token method 
Javascript :: react flip move 
Javascript :: discord.js pick random from array 
Javascript :: js tab active 
Javascript :: pdf table files download react not working 
Javascript :: debug react vscode 
Javascript :: javascript go to div id 
Javascript :: replace comma by new line in js 
Javascript :: ex. javascript loop aray 
Javascript :: usestate array delete 
Javascript :: node redis json set key 
Javascript :: generate random whole number between 2 javascript 
Javascript :: .env file node js 
Javascript :: clear whitespace from object javascript 
Javascript :: javascript add class 
Javascript :: javascript find string between two characters 
Javascript :: save text to file nodejs 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =