ASP.NET MVC返回产品型号代码,使用ff和谷歌浏览器都返回了如下的数据:
[{"ProductType":"JD4DBD-2D17-A1B2"},{"ProductType":"JD4BW1W-7SP7-A1B2"}],经在校验验,确定json格式正确,但却提示SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data。请各位大佬帮忙看看哪儿错了。新人初来,没有分数,还请见谅。
html端js代码如下:
$("#txtAutoComplete").typeahead({
source: function (query, process) {
return $.ajax({
url: "/OrderForm/GetProductTypeByType",
data: { "productType":query },
type: "POST",
dataType: "json",
success: function (result) {
var json = JSON.parse(result);
var resultList = json.topicList.map(function (item) {
var aItem = { ProductType: item.ProductType };
return JSON.stringify(aItem);
});
return process(resultList);
}
});
}
});