Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我的脚本中没有定义ajax数据_Ajax - Fatal编程技术网

我的脚本中没有定义ajax数据

我的脚本中没有定义ajax数据,ajax,Ajax,这是我的代码: function(id) { id=$.fn.yiiGridView.getSelection(id); console.log(id); jQuery.ajax({ 'url':'/index.php?r=client/loadOne', 'data':id, 'cache':false, 'success':function(html){jQuery( ".portlet-60

这是我的代码:

function(id) {                      
id=$.fn.yiiGridView.getSelection(id);
console.log(id);                            
jQuery.ajax({
'url':'/index.php?r=client/loadOne',
'data':id,
'cache':false,
'success':function(html){jQuery(
".portlet-60 .portlet-content")
.html(html)}});
它在控制台中获得以下输出:

["2"]
index.phpGET http://127.0.0.4/index.php?r=client/loadOne&undefined=undefined 500 (PHP Error)

我不明白为什么控制台中的id等于“2”,而ajax数据中的id是未定义的

数据应该是散列而不是单个值