php - Get Form Input via Ajax -


i have jqgrid plugin call via ajax. have index.php , getgriddata.php. how pass form input in getgriddata.php via ajax , use in getgriddata.php? tried serialize can't pass or access on getgriddata.php. need parameters mysql. here's code.

<script language="javascript" type="text/javascript"> function jggrid() {     $(document).ready(function () {         $("#grid").jqgrid({         url: "inc/controller/getgriddata.php"+$("#thisform").serialize(),         data : formdata,         datatype: "json",         mtype: "post",         colnames: ["siteid", "terminalid", "transactiontype", "amount", "servicestatus"],         colmodel: [         { name: "siteid"},         { name: "terminalid"},         { name: "transactiontype"},         { name: "amount"},         { name: "servicestatus"},         ],         pager: "#pager",         rownum: 10,         rowlist: [10,20],         sortname: "siteid",         sortorder: "asc",         height: 'auto',         viewrecords: true,         gridview: true,         caption: ""         });          }); } </script> 

getgriddata.php

include('../model/queries.php');  $cardnumber =       $_post['cardnumber']; $transact_type =    $_post['transact_type']; $fromdate =         $_post['fromdate']; $todate =           $_post['todate'];  $loyalty = new queries();  $get_mid =  $loyalty->loyaltyconn($cardnumber); $somedata = json_encode($loyalty->nposconn($get_mid, $transact_type, $fromdate, $todate));  echo $somedata; 

you passing data using url: "url"+$("#thisform").serialize() get variable retrieving post need change these:

$cardnumber = $_post['cardnumber']; // ... $todate = $_post['todate']; 

to this:

$cardnumber = $_get['cardnumber']; // ... $todate = $_get['todate']; 

change of them get check examples here.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -