custom variables php/ajax
custom variables php/ajax
Apologies if this question has been answered to death, but could someone give me a clearer explanation about specifically how to send a name/value pair to a php file that will return a MySQL query json object.
I'd like to send my php file the equivalent of http://myserver/myphp.php?provider='Company A'&program_type='Program B'
I looked at this example but couldn't figure out to send that name/value pair.(provider and program_type)
http://www.datatables.net/release-datatables/examples/server_side/custom_vars.html
Could someone show me how 'provider' and 'program_type' with their associated values would play in the example provided by dataTable?
Thanks so much!
This question has accepted answers - jump to:
Answers
Hello tomish,
Hopefully this will help. The Ajax processing example shows:
A post variable called myKey will be passed by the Ajax call and have a value of myValue and custom would have whatever value was typed into the myInput form field. They would be accessed on the server side by $_REQUEST['myKey'] and $_REQUEST['custom'].
So I believe that you are looking for is something like:
And they would be accessed on the server side by either request or post.
I hope I didn't confuse you further. ;)
The link you provided gives the tutorial on how to get it done. if you read it carefully you will understand. However I will attempt to give a little more explanation.
Take a look at this javascript.
take a look at this PHP server side script:
Thanks for both these postings! They make sense and I tried both - they do work but only up to a point. I get a '200 ok' message in my Chrome developer tool/network pane but an empty result set This is the query string submitted, which seems very verbose, and my variables are clearly in there, but no data returned :(
Sorry for the verbosity of this URL but it might provide some clues:
http://myServer/get.php?draw=1&columns%5B0%5D%5Bdata%5D=0&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=1&columns%5B1%5D%5Bname%5D=&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=0&order%5B0%5D%5Bdir%5D=asc&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&user=2&provider=CCC&program_type=Academic+Advising&_=1438894133525