我尝试过但失败的代码。哪里少了点什么……
$(".delete").click(function()
{
var db_id = $(this).attr("db_id");
alert(db_id);
$.post("ajax_inspection.php", {type: qrystrdelete,id: id},
function(data)
{
// callback function gets executed
$('#db_id').html(data);
alert("Return data" + data);
});
ajax.inspection.php 包含:
<?php
include_once("inspection_query_fun.php");
if($_REQUEST['type'] == 'qrystrdelete')
$var_result = deleteslab($_REQUEST['id']);
?>
Inspection_query_fun.php 包含 del
<php
function deleteslab($PAR_Id)
{
$sql = "DELETE FROM ".CONTROL_REPORT_DETAILS." WHERE sb_slab_id=".db_escape($PAR_Id);
db_query($sql);
}
?>