Reputation: 435
I am using flexigrid that calls php page to get data. On success i want to get ajax response data but it is returning html object of the flexigrid. How can i get response json?
Here is the code
$('.flexme').flexigrid({
url: 'data.php',
dataType: 'json',
colModel: <? php echo $this - > gridcols; ?> ,
striped: false,
width: 942,
height: 'auto',
showToggleBtn: false,
useRp: true,
rp: 15,
usepager: true,
onSubmit: addFormData,
showTableToggleBtn: true,
onError: function (data) {
alert("Error occured");
},
onSuccess: function (statusdata) {
console.log(statusdata);
},
preProcess: function(responsedata){
console.log(responsedata)
}
});
Here statusdata contains html for the grid not json from the URL.
Update:
Use
preProcess:function (jsondata) {
console.log(jsondata);
}
Upvotes: 1
Views: 2215
Reputation: 21
Just something to make clear, function preProcess must return a processed data. If you don't return data, flexigrid will display an connection error.
function preProcessData(data) {
/*do something with data*/
return data;
}
taken from here https://groups.google.com/forum/#!topic/flexigrid/y6c76Np2Xjw
Upvotes: 1