Basically I have written an AJAX script using pure javascript and I have a script that basically takes in a HTTP GET REQUEST.
e.g. script.php?id=2
I want to use this id within javascript so it can be sent via AJAX to return data from my database.
How can I access the id value. It should be possible as the value should be present within the headers of the loaded page.
Thanks!
Have a look at the
window.locationobject, the search property has the vales you’re interested in.This function will return an object which has all the variables as keys:
From your page you could use it like this: