Normally, when you make a post, the data looks something like this: “var1=value1&var2=value2&var3=value3”, but I want my url var to contain a post url in itself. With that said, ajax interprets the value that I want to be in the url variable as separate variables and values. In my run.php script, I want to be able to grab $_POST[“url”], and not have to grab $_POST[“fish”] and $_POST[“dog”] as well.
Also, I can’t just concatenate the variables in run.php because the variable names will vary…
var dataString = 'url=http://somewhere.com/tuna?fish=x&dog=y';
$.ajax({
type: "POST",
url: "/php/run.php",
data: dataString,
...
});
Any help is appreciated.
Thanks!
Let me know if further explanation is needed — I’m having a hard time explaining this, as you can tell.
Try this
In your php: