gpt4 book ai didi

php - AJAX NS_ERROR_XPC_BAD_CONVERT_JS : Could not convert JavaScript argument jquery. js:7065

转载 作者:可可西里 更新时间:2023-11-01 13:50:46 25 4
gpt4 key购买 nike

我是 jQuery 和 Ajax 的新手,我遇到了一个问题。我在我的控制台上收到以下错误:

NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument @ http://localhost
/jquery.js:7065

为什么我会收到此错误消息?

这是我使用的代码:

function upload_file(){
var file = document.form1.file_upload;
var date = document.form1.date_added;
var author = document.form1.author;
var user = document.form1.user;
var semester = document.form1.semester;
var class1 = document.form1.class;
var subject = document.form1.subject;
$.ajax({
type:"get",
url:"upload_file.php",
data:{
"file":file,
"date":date,
"author":author,
"user":user,
"semester":semester,
"class":class1,
"subject":subject
},
success:function(result){
$("#result").html(result);
}
});
}

我在等你的回复。

PS: I Did search the forum but did not get what i want, so if i missed something, sorry in advance.

最佳答案

我认为问题在于您正试图将完整的对象传递给 JSON。您应该使用值而不是对象。例如,替换:

var subject = document.form1.subject;

与:

var subject = document.form1.subject.value;

关于php - AJAX NS_ERROR_XPC_BAD_CONVERT_JS : Could not convert JavaScript argument jquery. js:7065,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12473251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com