On server I am returning an array after some operations. I want to work with this array after successing of AJAX.
var addPaymentType = function(){
var data = new Object()
data["function"] = "add";
data["payment_type_id"] = $("#payment_types").val();
data["data"] = $("#saveform").serializeArray();
$.ajax({
type: "POST",
url: location.href,
data: data,
dataType: "JSON",
success : function (data)
{
console.debug(data['plan_pt_id']);
}
});
};
But data['plan_pt_id'] is undefined
. If I return not an array, all works pretty. But how can I work with array?
Thank you.