Why does jQuery.ajax() add a parameter to the url?
- by FK82
Hi,
I have a data fetching method that uses jQuery.ajax() to fetch xml files.
/* */data: function() {
/* debug */try {
var url = arguments[0] ;
var type = arguments[1] ;
var scope = arguments[2] ;
var callback = arguments[3] ;
var self = this ;
if(this.cache[url]) {
callback(this.cache[url]) ;
} else if(!this.cache[url]) {
$.ajax({
type: "GET" ,
url: url ,
dataType: type ,
cache: false ,
success: function(data) {
if(type == "text/xml") {
var myJson = AUX.json ;
var jsonString = myJson.build(data,scope,null) ;
var jsonObject = $.parseJSON(jsonString) ;
self.cache[url] = jsonObject ;
callback(url) ;
} else if(type == "json") {
self.cache[url] = data ;
callback(url) ;
}
} ,
error: function() {
throw "Ajax call failed." ;
}
}) ;
}
/* debug */} catch(e) {
/* debug */ alert("- caller: signTutor.data\n- " + e) ;
/* debug */}
} ,
My problem is: jQuery somehow adds a parameter (?_=1272708280072) to the url if there are escaped (hexadecimal notation) or unescaped utf-8 characters outside of the ASCII range -- i believe -- in the file name. It all works well if the file name does not contain characters in that range.
Type is set to xml so there should not be a confusion of types. Headers of the xml files are also set adequately.
I can see from the console that jQuery throws an error, but I'm not sure as to where the problem really is.
Probably a problem with file name formatting, but I did not find any resources on the web as to AJAX file name specifications. Any ideas?
Thanks for you help!