Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 middle of another plain javascript function. But I can't get it to submit the data to the php page.

function postData() {
var postdataURL = "path/to/php/page.php";
    $.post (
        postdataURL, {
        "formid":5,
        "clientid":1,
        "userid":1,
        "level":mycat,
        "extra":mytimer,
        "pid":pid
        },
        function () {});
}
like image 308
user2843577 Avatar asked Dec 09 '13 22:12

user2843577


2 Answers

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.

like image 155
Phuc Tran Avatar answered Oct 19 '22 19:10

Phuc Tran


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.

like image 42
D.Raluca Avatar answered Oct 19 '22 20:10

D.Raluca