Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
161
rated 0 times [  165] [ 4]  / answers: 1 / hits: 116640  / 14 Years ago, thu, september 30, 2010, 12:00:00

I have the following code:



$.get('http://www.example.org', {a:1,b:2,c:3}, function(xml) {}, 'xml');


Is there a way to fetch the url used to make the request after the request has been made (in the callback or otherwise)?



I want the output:



http://www.example.org?a=1&b=2&c=3

More From » jquery

 Answers
1

I can't get it to work on $.get() because it has no complete event.



I suggest to use $.ajax() like this,



$.ajax({
url: 'http://www.example.org',
data: {'a':1,'b':2,'c':3},
dataType: 'xml',
complete : function(){
alert(this.url)
},
success: function(xml){
}
});


craz demo


[#95459] Monday, September 27, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
benitoh

Total Points: 150
Total Questions: 113
Total Answers: 104

Location: India
Member since Wed, Aug 26, 2020
4 Years ago
benitoh questions
Sun, Mar 21, 21, 00:00, 3 Years ago
Mon, May 13, 19, 00:00, 5 Years ago
;