我想做的是调用创建表的 PHP 文件,但我对 JQuery 不太熟悉。请帮忙。第二次调用 AJAX 后,我失去了在 TR 中的 onclick 和突出显示。
$.ajax({
url: 'save-all.php',
async: false,
data: $(this).serialize(),
type: 'POST',
success: function (msg) {
if (msg == 'true') {
$.get('orgs-list.php', {}, function (data) {
$('#tbl-content1').replaceWith($(data));
$("#success").show().fadeOut(3000);
});
} else {
$("#error").show().fadeOut(3000);
} //end #msg==true
} //end #success
}); //end #ajax
和 PHP 文件:
$stid = oci_parse($connection, 'SELECT org_id, agency, pobox, address1, address2, city, state, zipcode, realty_organizations.org_type AS org_type, realty_orgtype.org_type AS agencytype
FROM wflhd_admin.realty_organizations, wflhd_admin.realty_orgtype
WHERE realty_organizations.org_type = realty_orgtype.typeid
ORDER BY agency');
oci_execute($stid);
$nrows = oci_fetch_all($stid, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
?>
<table id='tbl-content1' cellpadding='3' width='100%' cellspacing='0' border='1' style='font-family:verdana; font-size: 11px;' >
<?
for ($i=0; $i<=$nrows; $i++) {?>
<tr id="row_<? echo $res[$i]['ORG_ID']; ?>" onClick="DoNavOrg('<? echo $res[$i]['ORG_ID']; ?>','<? echo $res[$i]['AGENCY'] ?>','<? echo $res[$i]['POBOX'] ?>','<? echo $res[$i]['ADDRESS1']; ?>','<? echo $res[$i]['ADDRESS2']; ?>','<? echo $res[$i]['CITY']; ?>','<? echo $res[$i]['STATE']; ?>','<? echo $res[$i]['ZIPCODE']; ?>','<? echo $res[$i]['ORG_TYPE']; ?>'); return false;">
}