Incorporating URL value from PHP GET into Ajax URL

Incorporating URL value from PHP GET into Ajax URL

dccevolutiondccevolution Posts: 13Questions: 3Answers: 0

I am having a moment and drawing a blank on what I know is probably really simple!

I have a URL of say www.mywebsite.com?=50
I then have php of

$id = intval($_GET['id']);

My datatable is then initialised as follows and needs to get the variable in the url

$(document).ready( function() {
var table = $('#example').DataTable( {
ajax: {
url: "json.php",
data: {
id: ?????
}
},

The bit I cant remember or figure out (despite endless searching!) is how do I get 50 into where the question marks are to end up with "json.php?id=50"?

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.