最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught TypeError: Illegal invocation in js using jQuery - Stack Overflow

programmeradmin2浏览0评论
 function makePvsApplicantCalls(){
         console.log('In makePvsApplicantCalls'); 
         $.ajax({
             type: 'GET',
             url: "/reppify/RPCPostAdapter/httprpc/applicationFacade/getPreviousApplicants",
             data : {jobId : jobId, page: pgNoPA++},
             cache: false,
             beforeSend: function(){
                 console.log('In makePvsApplicantCalls Before Send'); 
             },                     
             success: onSuccessPA,
             plete: function(){  
                 $('#prevSpinner').hide();
             },
             error: handleError,
             dataType: 'json'
        });
}

On Calling above javascript function, I'm getting following exception on browser and not able to make AJAX call, following is the invoking code

if(data.result>0) {
    makePvsApplicantCalls();
}

Following is the error

    Uncaught TypeError: Illegal invocation jquery.min.js:4
    e jquery.min.js:4
    ca jquery.min.js:2
    ca jquery.min.js:2
    ca jquery.min.js:2
    ca jquery.min.js:2
    f.extend.param jquery.min.js:4
    f.extend.ajax jquery.min.js:4
    makePvsApplicantCalls b2bscreening.js:2584
    $.ajax.success b2bscreening.js:2451
    n jquery.min.js:2
    o.fireWith jquery.min.js:2
    w jquery.min.js:4
    d jquery.min.js:4

How can I get rid of this exception?

 function makePvsApplicantCalls(){
         console.log('In makePvsApplicantCalls'); 
         $.ajax({
             type: 'GET',
             url: "/reppify/RPCPostAdapter/httprpc/applicationFacade/getPreviousApplicants",
             data : {jobId : jobId, page: pgNoPA++},
             cache: false,
             beforeSend: function(){
                 console.log('In makePvsApplicantCalls Before Send'); 
             },                     
             success: onSuccessPA,
             plete: function(){  
                 $('#prevSpinner').hide();
             },
             error: handleError,
             dataType: 'json'
        });
}

On Calling above javascript function, I'm getting following exception on browser and not able to make AJAX call, following is the invoking code

if(data.result>0) {
    makePvsApplicantCalls();
}

Following is the error

    Uncaught TypeError: Illegal invocation jquery.min.js:4
    e jquery.min.js:4
    ca jquery.min.js:2
    ca jquery.min.js:2
    ca jquery.min.js:2
    ca jquery.min.js:2
    f.extend.param jquery.min.js:4
    f.extend.ajax jquery.min.js:4
    makePvsApplicantCalls b2bscreening.js:2584
    $.ajax.success b2bscreening.js:2451
    n jquery.min.js:2
    o.fireWith jquery.min.js:2
    w jquery.min.js:4
    d jquery.min.js:4

How can I get rid of this exception?

Share edited Nov 23, 2012 at 9:00 rink.attendant.6 46.5k64 gold badges110 silver badges157 bronze badges asked Nov 23, 2012 at 8:47 Vardan GuptaVardan Gupta 3,5955 gold badges34 silver badges40 bronze badges 3
  • Where and how are you invoking it? – user1726343 Commented Nov 23, 2012 at 8:50
  • onSuccessPA is another function, which is available in my JS file and even beforeSend is not working – Vardan Gupta Commented Nov 23, 2012 at 8:51
  • 1 For debugging, always use non-minified versions of jQuery. Then show us the stacktrace, please. – Bergi Commented Nov 23, 2012 at 8:52
Add a ment  | 

2 Answers 2

Reset to default 4

Got my mistake, actually I was feeding two data input and unfortunately only 1 was global variable and one was local, RESOLVED NOW.

Try wrapping your success and error properties into functions because functions are expected there

Are you sure you are sending the data properly?

data : {'jobId' : jobId, 'page': pgNoPA++}
发布评论

评论列表(0)

  1. 暂无评论