我有一个带有 OndblClickRow 函数的 JQGrid,如下所示:
ondblClickRow: function(rowid)
{
rowData = $("#bookings").getRowData(rowid);
var brData = rowData['bookref'];
console.log(brData);
getGridRow(brData);
//$("#cp-bookings-dialog").dialog({ hide: 'slide', height: 625, width: 733, title: 'Booking Reference: - '+ brData});
},
这被传递给以下函数:
function getGridRow(brData) {
$.post("bookings-dialog.php", { 'rowdata': brData } );
$("#cp-bookings-dialog").load('bookings-dialog.php').dialog({ show: "slide", hide: 'slide', height: 625, width: 733, title: 'Booking Reference: - '+ brData});
,
加载 bookings.dialog.php 页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Title</title>
<?php
set_include_path($_SERVER['DOCUMENT_ROOT'] . "/onlinebookingv4/scripts/php/");
require_once('models/sql.php');
require_once('models/bookingdocket.php');
$pdo = new SQL();
$dbh = $pdo->connect(Database::$serverIP, Database::$serverPort, Database::$dbName, Database::$user, Database::$pass);
try {
$rowdata = $_POST['rowdata'];
$query = ("SELECT * FROM tblbookings WHERE bookref = '$rowdata'");
$stmt = $dbh->prepare($query);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_BOTH);
BookingDocket::set_id($row['id']);
BookingDocket::set_bookref($row['bookref']);
BookingDocket::set_bookdate($row['bookingdate']);
BookingDocket::set_returndate($row['returndate']);
BookingDocket::set_journeytype($row['journeytype']);
BookingDocket::set_passtel($row['passengertel']);
BookingDocket::set_returndate($row['returndate']);
$stmt->closeCursor();
}
catch (PDOException $pe) {
die("Error: " .$pe->getMessage(). " Query: ".$stmt->queryString);
}
$dbh = null;
?>
</head>
<body>
<div class="cp-tiles-wrapper-dlg">
<div class="cp-booking-info left">
<p class="pno-margin">Booking Date: <strong>Booking Reference is = <? echo BookingDocket::get_bookref(); ?></strong></p>
<p class="pno-margin">Query = <strong><? echo $query; ?></strong></p>
<p class="pno-margin">Journey: <strong></strong></p>
<p class="pno-margin">Passenger Tel: <strong></strong></p>
<p class="pno-margin">E-mail: <strong></strong></p>
</div>
</div>
</body>
</html>
我要做的是传递“brData”,这是对 bookings-dialog.php 的预订参考,以便我可以通过预订参考从数据库中选择所有预订。
目前,当我双击一行时,在萤火虫控制台中我得到以下信息:
POST bookings-dialog.php 显示SELECT * FROM tblbookings WHERE bookref = 'BR1278'
哪个是正确的
但它也显示:
获取正在显示的 bookings-dialog.phpSELECT * FROM tblbookings WHERE bookref = ''
对我来说,这似乎被某种方式覆盖了,我可能错了。
有人知道我怎样才能让它工作吗?