我正在使用JSON将数据放入我的数据库中,但在使用POST时我得到了
XML Parsing Error: no element found Location: moz-nullprincipal:{7c3ebd98-a00f-4a72-8a89-8094946cef8e Line Number 1, Column 1:
浏览器获取正确的JSON文件,但我仍然收到错误:
function comment() {
if ($.trim($("textarea#inputdefault").val()) != "") {
var reacties = $("textarea#inputdefault").val();
var reactie = {
reactieId: 2,
Datum: "2016-05-25 01:20:54.843",
Inhoud: $("textarea#inputdefault").val(),
voorstelId: voorstelID
}
postAjaxCall(commentUri, reactie);
console.log("Input: " + reactie);
console.log("commentUri: " + commentUri);
console.log("voorstelID: " + voorstelID);
console.log("voorstelID: " + voorstelID);
$('textarea#inputdefault').val('')
} else {
alert("Vul iets in!");
}
}
function postAjaxCall(commentUri, comment) {
$.ajax({
type: 'POST',
url: commentUri,
data: JSON.stringify(comment),
contentType: 'application/json'
}).success(function (data) {
console.log("URL: " + commentUri);
console.log("data: " + JSON.stringify(comment));
})
}
我找不到自己的错,已经失去了几个小时
答案 0 :(得分:0)
似乎有一个错字;我在手机上,所以我看不到行号,但在Ajax通话的底部附近,你有" url:commentUri&#34 ;;你打算说" commentUrl"?
编辑:没关系,我现在看到这是故意的。