Answers for "ajax before send"

3

how to set json type jquery ajax

$.ajax({
    type: "POST",
    contentType: "application/json",
    url: 'http://localhost:16329/Hello',
    data: { name: 'norm' },
    dataType: "json"
});
Posted by: Guest on June-30-2020
1

before send ajax loading

$("#loading").ajaxStart(function(){
   $(this).show();
 });

$("#loading").ajaxComplete(function(){
   $(this).hide();
 });
Posted by: Guest on November-23-2020
0

how to set json type jquery ajax

$.ajax({
            type: "POST",
            url: siteRoot + "api/SpaceGame/AddPlayer",
            async: false,
            data: JSON.stringify({ Name: playersShip.name, Credits: playersShip.credits }),
            contentType: "application/json",
            complete: function (data) {
            console.log(data);
            wait = false;
        }
    });
Posted by: Guest on June-30-2020
15

jquery ajax

$.ajax({

   url     : "file.php",
   method  : "POST",

       data: { 
         //key                      :   value 
         action                   	:   action , 
         key_1   					:   value_key_1,
         key_2   					:   value_key_2
       }
   })

   .fail(function() { return false; })
	// Appel OK
   .done(function(data) {

   console.log(data);

 });
Posted by: Guest on May-05-2020
0

before send ajax loading

$.ajax({
   url : dle_root + 'engine/ajax/fast.php',
   data: { text: response, action: action },
   beforeSend: function(){
     $("#loading").show();
   },
   complete: function(){
     $("#loading").hide();
   },
   success:  function (data) {
        if (data == 'ok') {
            DLEalert(dle_p_send_ok, dle_info);
        }
        else { DLEalert(data, dle_info); }
    });
 });
Posted by: Guest on April-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language