Hi,
I can get data from a MySQL table, but I can not get it after having edited somme cells to send it back in the MySql table.
The grid is dispalyed in a div: <div id="grid_php"></div>
And a "button" should allow to save the grid : <div id="button1">Bouton1</div>
Here is the code.
Unfortunately, in the $("div#button1").click(function(), "alert (data1)" displays "undefined".
Then nothing is sent to my test.php code that sould save the data.
Can somebody explain me what is wrong ?
$(function () {
var colM = [
{ title: "Id", width: 100, dataIndx: "id" , editable: false, sortable: false },
{ title: "Order ID", width: 130, dataIndx: "order_id" , editable: true, sortable: true, validations: [ { type: 'gt', value: '10', msg: 'Required' } ] },
{ title: "Invoice Date", width: 190, dataIndx: "invoice_date" , editable: true}
];
var dataModel = {
location: "remote",
dataType: "JSON",
method: "GET",
getUrl : function () {
return { url: 'remote.php'};
},
getData: function ( response ) {
return { data: response };
},
//postData: {colModel: colM, dataModel: dataModel}
};
$("div#grid_php").pqGrid({ width: 900, height: 400,
collapsible: true,
dataModel: dataModel,
colModel: colM
});
$("div#button1").click(function(){
var data1 = JSON.stringify(dataModel.data);
alert (data1);
$.ajax({
url : 'test.php',
type : 'GET',
dataType : 'html',
data : data1,
success : function(code_html, statut){
alert(code_html);
},
error : function(resultat, statut, erreur){
alert('error');
}
});
});
});