MakeEditable json callback
MakeEditable json callback
I want to show a message that comes from the server in case of failure or success. I am sending the data to the file server and this returns me a json response. I would like to retrieve and display this message but can not find any function / setting that will allow me that.
[code]var oTable = $('#example').
dataTable( {dataTable( {
"bServerSide": true,
"sServerMethod": "POST",
"bPaginate": false,
"bSort": false,
"sScrollX": "500",
"sAjaxSource": "list.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "name":"id", "value": $("input#id").val()});
},
"bJQueryUI": false,
"aoColumnDefs": [
{ "bSortable": false,"aTargets":['_all']}
]})
.makeEditable({
sUpdateURL: "edit.php",
fnOnCellUpdated: function(){
oTable.fnDraw();
},
ajaxoptions:{
dataType: "json",
type: 'POST'
},
(...)
);
[/code]
In edit.php I do the update operation on the database and return a message. I want to show this message.
[code]
$sql="UPDATE Table set $column_name='$value' WHERE id=$id";
$rs=mysql_query($sql);
$qtd = mysql_affected_rows();
if ($qtd >0){
$resp_json = array( 'msg' => "Success!",
'error'=>0);
}
else
{
$resp_json = array( 'msg'=>"Failure", 'error'=>1);
}
mysql_close();
echo json_encode($resp_json);
[/code]
another question, how i hide the search field?
[code]var oTable = $('#example').
dataTable( {dataTable( {
"bServerSide": true,
"sServerMethod": "POST",
"bPaginate": false,
"bSort": false,
"sScrollX": "500",
"sAjaxSource": "list.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "name":"id", "value": $("input#id").val()});
},
"bJQueryUI": false,
"aoColumnDefs": [
{ "bSortable": false,"aTargets":['_all']}
]})
.makeEditable({
sUpdateURL: "edit.php",
fnOnCellUpdated: function(){
oTable.fnDraw();
},
ajaxoptions:{
dataType: "json",
type: 'POST'
},
(...)
);
[/code]
In edit.php I do the update operation on the database and return a message. I want to show this message.
[code]
$sql="UPDATE Table set $column_name='$value' WHERE id=$id";
$rs=mysql_query($sql);
$qtd = mysql_affected_rows();
if ($qtd >0){
$resp_json = array( 'msg' => "Success!",
'error'=>0);
}
else
{
$resp_json = array( 'msg'=>"Failure", 'error'=>1);
}
mysql_close();
echo json_encode($resp_json);
[/code]
another question, how i hide the search field?
This discussion has been closed.