I'm sorry if this answer seems similar to other questions in this website, but I couldn't find what I need.
I have this code:
$.ajax({
url: '../../cgi-bin/executeQuery',
type: 'GET',
data: ({siid:5185,of:"xmlWithColID"}),
dataType: 'xml',
success: function(xmlR){
开发者_开发技巧 try{
$.ajax({
url: '../../cgi-bin/authList.py',
type: 'GET',
data: ({xmlToFormat:xmlR,service:"paperList"}),
dataType: 'xml',
success: function(data){
try{
displayResult(data,loadXMLDoc("js/authList/paperTableStyle.xsl"),"divPaperTable");
}catch(e){
console.log(e.message);
}
},
complete: function(XMLHttpRequest, textStatus){
$('#divMakingAuthorList').addClass('secondary');
$('#divMakingAuthorList').hide();
}
});
}catch(e){
console.log(e.message);
}
}
});
That gives me the following error in FF: "Illegal operation on WrappedNative prototype object".
When I removed the "success" part of my code, the error message was still there. After, I removed the "complete" parte and the error message was there too. But then, when I removed the following line of my code: data: ({xmlToFormat:xmlR,service:"paperList"}), The message was gone.
But I don't understand the reason. Is it possible to send "xml" to my CGI as data in an ajax event?
Thanks
That error message typically refers to when you try to wrap a native function like for instance "eval"
If you do something like this -
(function() {
var t = eval;
eval = function() {
t.apply(window, arguments);
}
}();
Firefox won't allow you to use eval anymore because the function signature no longer matches it's internal reference point and it considers this a devious tactic. I think it's completely stupid and violates the very premise of javascript's flexibility, but it's what we now have to deal with.
Same goes for something like var x = document.createElement; calling x('div') will make firefox whine like an emo teen.
My guess is that when xmlR is not passed to the second ajax request the request fails and so your success block is never called. I know you mention that you tried the call without the success block and you still saw the message but maybe you could try again with an empty success function to confirm.
I'd check out what's going on in displayResult and loadXMLDoc - and I believe the illegal operation safety checks were recently added to FireFox so if you can try an older version like 3.0 you might confirm this distinction.
Otherwise I don't see anything glaring with the code you provided and sending xml data is completely valid with ajax.
精彩评论