我收到此错误(仅Safari ,Chrome和Firefox正在运行):SyntaxError:意外的令牌'}'。期待一个':'关注物业名称' params'关于功能:
function buildprojecttypeselect(params){
var result;
$.ajax({
type: "POST",
url: "include/builds/buildprojecttypeselect.php",
async: false,
contentType: "application/json",
data: JSON.stringify({params}),
success: function(data) {
result = $.parseJSON(data);
}
});
return result;
}
json.stringify({params})出了点问题。
params是一个数组=
[Object { 0="2", 1="name1", id_projecttype="2"},
Object { 0="3", 1="name2", id_projecttype="3"},
Object { 0="4", 1="nam3", id_projecttype="4"}]
答案 0 :(得分:0)
你不需要params
周围的大括号:
function buildprojecttypeselect(params){
var result;
$.ajax({
type: "POST",
url: "include/builds/buildprojecttypeselect.php",
async: false,
contentType: "application/json",
data: JSON.stringify(params),
success: function(data) {
result = $.parseJSON(data);
}
});
return result;
}