Is there a way that I can see the URL that was requested when I do an Ajax request with jQuery?
e.g.,
var some_data_object = { ...all sorts of junk... } $.get('/someurl.php',some_data_object, function(data, textStatus, jqXHR) { var real_url = ? # <-- How do I get this })
How can I access the URL that jQuery actually used to make the request? Perhaps some method/property of jqHXR
? I couldn't find it in the documentation.
Thanks.
The $. ajax() Function. The url parameter is a string containing the URL you want to reach with the Ajax call, while settings is an object literal containing the configuration for the Ajax request. In its first form, this function performs an Ajax request using the url parameter and the options specified in settings .
url: A string URL to which you want to submit or retrieve the data. options: Configuration options for Ajax request. An options parameter can be specified using JSON format. This parameter is optional.
jQuery - ajaxSuccess( callback ) Method The ajaxSuccess( callback ) method attaches a function to be executed whenever an AJAX request completes successfully. This is an Ajax Event.
ajax() : $. ajax({ type: 'POST', url: 'page. php', data: stuff, success: function( data ) { }, error: function(xhr, status, error) { // check status && error }, dataType: 'text' });
Set a break point in success method, then watch
this.url
is the real url for the request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With