我在尝试在Jquery中使用ajax调用时遇到以下错误。我在下面解释我的代码。
Error: Uncaught TypeError: Illegal invocation
at e (http://oditek.in/fyndspace/js/jquery.js:4:23990)
at Vc (http://oditek.in/fyndspace/js/jquery.js:4:23875)
at Vc (http://oditek.in/fyndspace/js/jquery.js:4:23898)
at Function.m.param (http://oditek.in/fyndspace/js/jquery.js:4:24236)
at Function.ajax (http://oditek.in/fyndspace/js/jquery.js:4:20195)
at Function.m.(anonymous function) [as post] (http://oditek.in/fyndspace/js/jquery.js:4:22297)
at saveAllManageSpaceData (http://oditek.in/fyndspace/listyourspace:1418:6)
at HTMLButtonElement.onclick (http://oditek.in/fyndspace/listyourspace:693:102)
我的工作代码如下:
<button class="btn nextbtnbgdiv open6" type="button" onclick="saveAllManageSpaceData();">Save & Continue <span class="fa fa-arrow-right"></span></button>
var data={"city":city,"area":area,"list_name":list_name,"file_data":file_data,"stDate":stDate,"endDate":endDate,"address":address,"latitude":latitude,"longitude":longitude,"description":description,"tag_google_map":tag_google_map,"space_area":space_area,"space_status":space_status,"price":price,"sPrice":sPrice,"price_type":price_type,"booth_size":booth_size,"height":height,"width":width,"spaceAccess":spaceAccess,"rules":rules,"Overview":Overview,"depositeForLoss":depositeForLoss,"dkeyAccess":dkeyAccess};
console.log('hello',data);
var url="common.php?action=saveManageSpace";
$.post(url,data,function(data){
console.log('res',data);
});
这里我在使用ajax调用时遇到上述错误。请帮我解决这个问题。
答案 0 :(得分:0)
您的数据是一个对象 - 您可能想要尝试作为数组
var data=[{"city":city,"area":area,"list_name":list_name,"file_data":file_data,"stDate":stDate,"endDate":endDate,"address":address,"latitude":latitude,"longitude":longitude,"description":description,"tag_google_map":tag_google_map,"space_area":space_area,"space_status":space_status,"price":price,"sPrice":sPrice,"price_type":price_type,"booth_size":booth_size,"height":height,"width":width,"spaceAccess":spaceAccess,"rules":rules,"Overview":Overview,"depositeForLoss":depositeForLoss,"dkeyAccess":dkeyAccess}];