Forum Moderators: open
<script type="text/javascript">
function edit(com, grid) {
if (com == 'Edit') {
if($('.trSelected').length>0){
if($('.trSelected').length>1){
alert('Please select just one row');
return;
}
var items = $('.trSelected');
var itemlist ='';
for(i=0;i<items.length;i++){
itemlist+= items[i].id.substr(3);
}
$.ajax({
type: "POST",
dataType: "json",
url: "tempcontact.php",
data: "items="+itemlist,
success: function(data){
alert("Query: "+data.query+" - Total affected rows: "+data.total+" - The Name: "+data.name+" Email: "+data.email);
jQuery.facybox({ div: "#editform"});
$("#flex1").flexReload();
}
});
} else{
alert('Please select a row to edit.');
}
}
}
</script>
json data
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "query: '".$sql."',\n";
$json .= "total: $total,\n";
$json .= "name: '".$name."',\n";
$json .= "email: '".$email."',\n";
$json .= "}\n";
echo $json;