我有以下 ajax 来调用我的服务,该服务从数据库中获取一些记录并将其填充到我的前端...但是我收到 json:unexpected character 错误...请您帮我解决这个问题...
'http://localhost/WcfService/Service1.svc/remarksList';
var tempyear="";
$.ajax({
url: urlToHandler,
data:JSON.stringify({oei:{"reqNo1":reqNo,"loginid":userid}}),
type: 'POST',
dataType:"json",
contentType: 'application/json',
success: function(data) {
alert(data.fillRemarksListResult);
myData = JSON.parse(data.fillRemarksListResult, function (key, value) {
var type;
if (value && typeof value === 'object') {
type = value.type;
if (typeof type === 'string' && typeof window[type] === 'function') {
return new (window[type])(value);
}
}
return value;
});
alert(myData);
$.each(data.fillRemarksListResult,function(key,val){
alert(val.rmrkreqNo1);
});
},
error: function(data, status, jqXHR) {
alert('There was an error.');
}
}); // end $.ajax
});
现在我得到这个错误:
* Json.parse:unexpected character myData=JSON.parse(data.fillRemarksListResult, function (key, value) { *
当作为警报给出时,我的 AJAX 调用还返回 [object Object]、[object Object]、[object Object]、[object Object]、[object Object]、[object Object]、[object Object]...