TypeError: 'click' called on an object that does not implement interface HTMLElement

前端 未结 4 668

I have some javascript that sends data to a function that calls a php page, however I get an error that I can\'t find any information on. The postData() call is in the middl

相关标签:
4条回答
  • 2021-01-17 21:15

    Review your variable mycat, mytimer, pid is may be a jQuery Object. That mean you had asigned

    mycat = $('#cate')
    

    If that true, you just fix that

    mycat = $('#cate').val()
    

    Or some code get real value.

    0 讨论(0)
  • 2021-01-17 21:19

    remove the " from the name of the properties

    $.post (
        postdataURL, {
        formid:5,
        clientid:1,
        userid:1,
        level:mycat,
        extra:mytimer,
        pid:pid
        },
        function () {});
    

    And add a

    alert("Got called"); 
    

    after

    function postData() { 
    

    to be sure the function is being called

    0 讨论(0)
  • 2021-01-17 21:25

    I ran in to this when doing a jQuery $.ajax() call like you did. Apparently (in my case) it was caused by referencing a variable that wasn't in scope and was undefined. For example, in your code:

        "level":mycat,
        "extra":mytimer,
        "pid":pid
    

    If mycat, mytimer, or pid were null, and you're having the same problem, that would do it.

    0 讨论(0)
  • 2021-01-17 21:34

    In my case was the same problem like @user3740976. I put in url an undefined parameter.

    $.ajax({
         type: requestType,
         url: url,       
         dataType: dataType,
         data: dataParams,
     ...
    

    Where dataParams is

     {"title":{},"iSBN":"111","partNumber":"3332","bookCategory":"1"}
    

    title being undefined.

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