EasyUI Forum
May 21, 2024, 05:01:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: loading Data from a multiple function PHP file  (Read 10537 times)
JDMcQ
Newbie
*
Posts: 6



View Profile
« on: January 24, 2015, 08:15:16 AM »

I have no problem getting a Data grid to load data with a .php file, but I don't want to have a separate file for every Grid load etc.

So my attempted solution was to pass the name of the function in a POST var.But EasyUI completely ignores everything at this point. See Code below.

Code:
	$CID = isset($_POST['CatID']) ? intval($_POST['CatID']) :0;
$Func = isset($_POST['fn']) ? $_POST['fn'] :'Bad';

if ($Func == 'PT')
PTable ($CID);

if ($Func == 'Bad')
PTable ($CID);

function PTable($CID){
$result = array();

The PTable function works great asl long as it's not in a function.

Please help.

Logged
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« Reply #1 on: January 24, 2015, 04:43:37 PM »

How do you build the url ?

table id="dg"
   url=".your.php?CatID=1&fn=MyFunc"
...>

as you are using this particular URL the parameters came in the $_GET array and not in $_POST so you have to fix your code to
   $CID = isset($_GET['CatID']) ? intval($_GET['CatID']) :0;
   $Func = isset($_GET['fn']) ? $_$_GET['fn'] :'Bad';

or use $_REQUEST
   CID = isset($_REQUEST['CatID']) ? intval($_REQUEST['CatID']) :0;
   $Func = isset($_REQUEST['fn']) ? $_$_REQUEST['fn'] :'Bad';


HTH
Yamil
Logged
JDMcQ
Newbie
*
Posts: 6



View Profile
« Reply #2 on: January 24, 2015, 06:38:50 PM »

Actually I'm using POST. Therefore I'm not placing anything in my url except the page. When code is not within a function I can report the 'fn' value and 'CID' value in the grid as soon as I put the code into a function, nothing works. Have you been able to use GET to do this? P.S. thanks for responding.
Logged
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« Reply #3 on: January 24, 2015, 10:36:16 PM »

The URL trick works for me...
And place an alter or console.log to verify if your function is called...

Regards,
Yamil
Logged
JDMcQ
Newbie
*
Posts: 6



View Profile
« Reply #4 on: January 25, 2015, 08:36:35 AM »

I would really like to use the "queryParams" function to pass the data (and function name).
My understanding is that this is via POST. Question: can I GET & POST in the same call?  The function will be the same so I can attach that to the URL,
but the CID will change on every call, so the "queryParams" works really well for that.

Having a look at the console did reveal something interesting though. I see that the error references "fn" which happened to be my POST variable name
so I changed it to "ff" in case I had stumbled upon a reserved word. No change.
Here is the console output, what does it mean?
Code:
 POST
 http://192.168.1.165/phpfiles/FTest.php 500 (Internal Server Error)         jquery-1.4.4.min.js:141
 c.extend.ajax       jquery.easyui.min.js:10127
 $.fn.datagrid.defaults.$.extend.loader           jquery.easyui.min.js:9418
 _6c6                jquery.easyui.min.js:9415
 (anonymous function)
Logged
JDMcQ
Newbie
*
Posts: 6



View Profile
« Reply #5 on: February 07, 2015, 08:20:11 PM »

So I see I have stumped everybody!! Huh

Anybody have a sample of a DataGrid Loader function that calls PHP? Maybe I could use that??? I really don't want to have to go looking for another UI solution.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!