Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Ajax success function parameters

  $.ajax({  
            type: "POST",  
            url: "contacts.php",  
            data: dataString,  
            cache: false,  
            success: function(data, status, settings)  
            {  
               alert(The request URL and DATA);
            }  
            ,
            error: function(ajaxrequest, ajaxOptions, thrownError)  
            {  

            }  
        });

How can I alert the The request URL and DATA parameters inside the Success function?

Thank You

like image 397
nullException Avatar asked Jan 23 '12 12:01

nullException


People also ask

What does success function do in AJAX?

AJAX success is a global event. Global events are triggered on the document to call any handlers who may be listening. The ajaxSuccess event is only called if the request is successful. It is essentially a type function that's called when a request proceeds.

How check AJAX request is successful jQuery?

$. ajax({ url: "page. php", data: stuff, success: function(response){ console. log("success"); } });

How can I get success response in AJAX?

In most cases, you will need to specify the success and error callbacks. The success callback will be called after the successful completion of the AJAX call. The response returned by the server will be passed along to the success callback.


1 Answers

You can simply;

success: function(data, textStatus, jqXHR)
{
   alert(this.data + "," + this.url); 
}
like image 186
Alex K. Avatar answered Sep 18 '22 08:09

Alex K.