Passing a Jquery variable to use in php script -


I have a booking grid as shown below:

 Enter the image details here

On this booking grid I have a dblClick event, which opens a Jquery Dialog :

  & lt; Div id = "cp-bookings-dialog" & gt; & Lt; Div class = "cp-tiles-wrapper-dlg" & gt; & Lt; Div class = "cp-booking-info left" & gt; & Lt; P class = "pno-margin" & gt; Booking Date: & amp; Nbsp; & Lt; Strong & gt; Booking Reference = & lt;? Echo BookingDocket :: get_bookref (); ? & Gt; & Lt; / Strong> & Lt; / P & gt; & Lt; P class = "pno-margin" & gt; Refund date: & amp; Nbsp; & Lt; Strong & gt; & Lt;? Echo BookingDocket :: get_bookdate (); ? & Gt; & Lt; / Strong> & Lt; / P & gt; & Lt; P class = "pno-margin" & gt; Travel: & amp; Nbsp; & Lt; Strong & gt; & Lt; / Strong> & Lt; / P & gt; & Lt; P class = "pno-margin" & gt; Traveler Telephone: & amp; Nbsp; & Lt; Strong & gt; & Lt; / Strong> & Lt; / P & gt; & Lt; P class = "pno-margin" & gt; E-mail: & amp; Nbsp; & Lt; Strong & gt; & Lt; / Strong> & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

Jquery Code:

  ondblClickRow: function (queued) {var rowData = new array (); Row data = $ ("# booking"). GetRowData (queued); Var brData = rowData ['bookref']; GetGridRow (brData); $ ("#cp-bookings-dialog") Dialog ({hide: 'slide', height: 625, width: 733, title: 'booking reference: -' + brData}); },   

Where the brData 'booking reference' value is what I want to use in my PHP script. Currently, this DBLClick event is being sent on the following Ajax request:

  function getGridRow (brData) {$ .ajax ({url: 'script / php / bootstrp / all.request.php', Type: 'post', data: {rowdata: brData, id: null, condition: null}, data type: 'text / xml', timeout: 20000, error: function () {warning ("this failed"); $ ('# Cp-div-error'). Html (''); $ ('# cp-div-error'). An error occurred while entering the attachment ('& lt; p & gt; data, please later Try again & lt; / p & gt; '); $ (' # cp-div-error '). Communication (' Open ');}, Success: Function Reaction) {// fresh page // response = brData; // alert (feedback); <--- this correct booking reference warning}});   

is sent to everyone .request.php

  // Switch to set the method to switch switches ($ _REQUEST [' Fnme ']) {case' GetDGRow ': header (' content-type: text / xml '); GetBookings :: getGridRow ($ _ requests ['rowdata']); break;   

And finally in the PHP script where I want to use this Jquery value:

  class GetBookings {public static function getGridRow ($ rowdata) { $ Rowdata = $ _REQUEST ['Rowdata']; $ Pdo = new SQL (); $ Dbh = $ pdo- & gt; Connect (database :: $ serverIP, database :: $ server port, database :: $ dbName, database :: $ user, database :: $ pass); Try $ {Query = "SELECT * tblbookings WHERE bookref = '$ rowdata'"; $ Stmt = $ dbh- & gt; Ready ($ query); $ Stmt- & gt; Executed (); $ Line = $ stmt-> Obtain (PDO :: FETCH_BOTH); {All of the variables are here} $ stmt-> Closed cursor (); } Hold (PDO Exception $ pay) {Dead ("Error:" $ pe-> getMessage (). "Question:". $ Stmt-> query string); } $ Dbh = null; }}   

I'm not sure why, but it does not work. In addition, it is worth noting that when you click on DBL on a booking, it opens a JEL dialog box which displays all the details about the booking and it is available from $ query = "SELECT * FROM tblbookings" The results should return where Bookref = '$ Rowdata' ";

Whatever I have to do, it correctly passes this data and it will work as I would like to assign a booking reference value to $ rowdata I work with it, it works as it should be.

If someone can help me with this, I would be very grateful because I have been trying to work it for some time: (

< View your code:

  var rowData = new array ()  

/ Pre>

The second row has overwritten the first row, so that you rowData = new array () .

Now, are you sure that the $ _REQUEST ['fnme'] is present? Your switch statement is not in any default value, And it seems that getGridRow () will never be executed.

Additionaly, $ rowdata = $ _REQUEST ['rowdata'] Meaningless, you can remove it.

I hope this will help you.

Comments