Illegal invocation error in ajax (Jquery 1.7.1)

后端 未结 2 1613
無奈伤痛
無奈伤痛 2021-01-17 03:15

I am trying to post an ajax request using jquery

var peName = document.getElementById(\"peName\").value;
     var peSubName = document.getElementById(\"peSub         


        
2条回答
  •  天涯浪人
    2021-01-17 03:48

    I'm a novice, but this error happened to me when I did something like the following:

    // the following will *error*
    var element = $("#elementId");
    $.post("/foo/bar/", { xxx : element });
    

    Anytime you feed $.post something other than a string, JS errors. i.e., peId, pecatId, etc. must all be strings, not jQuery objects.

提交回复
热议问题