Php Ajax对javascript数组的响应
我想把ajax响应放到Javascript数组中 比如说 服务器端Php Ajax对javascript数组的响应,php,javascript,ajax,Php,Javascript,Ajax,我想把ajax响应放到Javascript数组中 比如说 服务器端 $response = '{x1:12, x2:32, x3:0}' echo $respons; 客户端 var arrayObject = [{x1:132, x2:332, x3:320}] arrayobject += [ajaxResponse]; 使用JSON.parse将文本转换为真实对象,使用Array.push将其添加到数组中 arrayobject.push(JSON.parse(ajaxResp
$response = '{x1:12, x2:32, x3:0}'
echo $respons;
客户端
var arrayObject = [{x1:132, x2:332, x3:320}]
arrayobject += [ajaxResponse];
使用JSON.parse将文本转换为真实对象,使用Array.push将其添加到数组中
arrayobject.push(JSON.parse(ajaxResponse));
非常模糊,您需要添加更多细节,以便任何人都能回答此问题。基于此问题,我认为这是最佳答案。字符串应为:“{”x1:12,“x2:32,“x3:0}”谢谢,这对我帮助很大。