Illegal operation on WrappedNative prototype object

前端 未结 1 1748
半阙折子戏
半阙折子戏 2020-12-20 16:36

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({
                 


        
相关标签:
1条回答
  • 2020-12-20 16:38

    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.

    0 讨论(0)
提交回复
热议问题