JQuery AJAX syntax

var data="abc";
$.ajax({
    type: "POST",
    url: "page.php",
    data: {
        "data":data,
    },
    dataType: "json",

    //if received a response from the server
    success: function( datas, textStatus, jqXHR) {

    },

    //If there was no resonse from the server
    error: function(jqXHR, textStatus, errorThrown){

    },

    //capture the request before it was sent to server
    beforeSend: function(jqXHR, settings){

    },

    //this is called after the response or error functions are finished
    //so that we can take some action
    complete: function(jqXHR, textStatus){

    }

}); 

Ask Confirmation Before Call an Ajax request in Jquery

# HTML Button::

<button onclick="status_change(1)" >Call Ajax</button>

# JavaScript Code::

<script type="text/javascript">

function status_change(id) {
    $.confirm({
       'title' : 'Attention!',
       'message' : 'Want to Continue?',
       'buttons' : {
            'YES' : {
            'class' : 'blue',
            'action': function(){
                $('#loading').html('ring.gif'); 
                $.ajax({
                   type: "POST",
                   url: "url/"+id,
                   data:{ID:id},
                   success: function(msg){

                            window.location.reload();
                   }
               });
            }
         },
         'NO' : {
            'class' : 'gray',
            'action': function(){
                 return false;
            } 
              // Nothing to do in this case. You can as well omit the   action property.
       }
    }
 });

}
</script>