我使用以下代码来获取在控制台中打印的响应。但是我在控制台中显示为null。无法获取在控制台中打印的响应
在index.php网址我有JSON代码
new Ajax.Request('http://10.239.50.92/sample/index.php', {
method:'get',
onSuccess: function(products){
//alert(products.hasOwnProperty(value));
//alert(products.hasOwnProperty());
console.log(products.responseJSON);
}
});
嗨斯佩兰斯基,我有一个类似的问题,我似乎找出原因, 我在后端使用perl/cgi,我的代码如下 – 2012-09-07 20:45:44
'new Ajax.Request('ajax-sr- update.cgi”,{ \t \t方法: '得到', \t \t的onSuccess:功能(传输){ \t \t \t变种响应= transport.responseText; \t \t变种JSON =的eval( '(' +响应+')') \t \t console.log(json); \t \t \t如果(JSON){ \t \t \t \t如果(json.error_message){ \t \t \t \t \t做一些事情; \t \t \t \t} else if(json。incident_id){ \t \t \t \t \t做某事别的; \t \t \t \t}否则{ \t \t \t \t \t显示的一般错误 \t \t \t \t} \t \t \t}否则{ \t \t \t \t一般错误 \t \t \t} \t \t}, \t \t onFailure处:功能(数据){ \t \t \t显示失败 \t \t} \t});' – 2012-09-07 20:50:21