RusAlex
RusAlex

Reputation: 8575

ajax data is undefined in my script

this is my code:

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)}});

and it gets me this output in console:

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

I don't understand why id in console equals "2", bud in ajax data is undefined.

Upvotes: 0

Views: 656

Answers (1)

Amareswar
Amareswar

Reputation: 2064

data should be hash not a single value

Upvotes: 1

Related Questions