我是带有外部内容的 Sharepoint 2013 应用程序的新手。我可以从 SQL 中提取数据并填充到应用程序页面中。但是我尝试添加新数据,收到以下错误消息
来自网页的消息
{"readyState":4,"responseText":"{\"error\":{\"code\":\"-1, Microsoft.SharePoint.Client.InvalidClientQueryException\",\"message\":{\"lang\":\"en-US\",\"value\":\"An entry without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.\"}}}","status":400,"statusText":"Bad Request"}
好的
我使用了以下代码
create: function (dname, description) {
debugger;
$.ajax({
url: _spPageContextInfo.webServerRelativeUrl +
"/_api/web/lists/getByTitle('tblDomain_SP')/items",
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify({'DomainName':dname,'Description':description}),
dataType: "json",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function () {
REST.DomainFormFiller.clear();
},
error: function (err) {
alert(JSON.stringify(err));
}
});
}
你能帮我将数据插入到 sql 表中吗?