URL string string entry in GET request jQuery.ajax ()

I want to write a fully constructed string of jQuery.ajax call url. I set the parameters in the data variable of the ajax command, for example:

jQuery.ajax({ url: 'http://a.site.com', data: { format: 'json', name: 'John Smith', addressdetails: 1 }, beforeSend: function(jqXHR, settings) { console.log(jqXHR, settings); // Can't find it in these values }, success: function(data, textStatus, jqXHR) { console.log(data, textStatus, jqXHR); // Nor in these } }); 

What I would look for in the logs from the above example is this line:

 'http://a.site.com?format=json&name=John%20Smith&addressdetails=1' 

I feel like I'm missing something. I am convinced that this will be in one of the callback functions, but for me life cannot find it anywhere. Any help was appreciated.

+4
source share
1 answer
 settings.url 

See snippet:

 $.ajax({ url: 'http://google.com', data: { format: 'json', name: 'John Smith', addressdetails: 1 }, beforeSend: function(jqXHR, settings) { document.write(settings.url); } }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> 
+7
source

Source: https://habr.com/ru/post/1416623/


All Articles