[eluser]stefenw[/eluser]
Quote:Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.
i use this
returning json from controller
Code:
$x = $this->input->post('x');
echo json_encode(array("datacallback" => array("1" => $x)));
if result as row
Code:
$.ajax({
type: "POST",
url: //url target,
data: {x : "abc"},//to add more ada
dataType: "json"
}).done(function(data){
var x = data.datacallback.1;
}
x will contain abc
if you need to loop trough returned json use this
Code:
$.each(data.datacallback, function(k, item) {
alert (item.arraykeyname)
});