$.ajax({
    url: "test.html",
    context: document.body
}).done(function() {
    //show data
});
how to save data from ajax request into a variable and then show it? and how to show a message "loading..." while it is proccessing?
$.ajax({
    url: "test.html",
    context: document.body
}).done(function() {
    //show data
});
how to save data from ajax request into a variable and then show it? and how to show a message "loading..." while it is proccessing?
 
    
     $.ajax({
    url: "test.html",
    context: document.body
}).done(function(data) { 
    alert(data);
});
UPDATED:
$.ajax({
    url: "test.html",
    context: document.body
}).done(function(data) {
   $('#loading').hide();    
   // alert(data);
});
markup:
<div id='loading'></div>
 
    
    For loading message, use beforeSend() in ajax.
  beforeSend : function () {
      $('body').html('Loading...');
  }
 
    
    You can try something like this. In your function you can show loading div
function your_ajax() {
  $('#loading').show();
  $.ajax({
    url: "test.html",
    context: document.body
    }).done(function(data) {
     $('#loading').hide();      
     alert(data);
  });
}
Please add this part in your html
<div id="loading" style="display:none;">Loading </div>
