I'm new to jQuery and Ajax and I have run into a problem. Im getting the error on my console that:
NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument @ http://localhost
/jquery.js:7065
Why am I receiving this error?
this is the code Im Using:
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);
}
});
}
Im waiting for your replies.
PS: I Did search the forum but did not get what i want, so if i missed something, sorry in advance.
I think the problem is you are trying to pass complete objects to the JSON. You should use values instead of objects. For example, replace:
var subject = document.form1.subject;
with:
var subject = document.form1.subject.value;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With