Reputation: 3226
I am using the javascript below to send information from one website to another, but I don't know how to add more data. ?url is fine. I'm not sure how to add more data to the javascript. I would like to add an ?img, a ?title ... i tried a few times but no luck. Help please.
onclick="window.open('http://mysite.com/submit.?url='+(document.location.href));return false;"
$url = $_GET['url'];
Upvotes: 1
Views: 335
Reputation: 163448
Separate the parameters with &
.
http://mysite.com/submit?param1=value1¶m2=value2¶m3=value3
You should also encode your values with encodeURI()
.
Upvotes: 4
Reputation: 160261
You wouldn't add ?moreParm...etc
, you use an ampersand (&
) to add additional parameters.
var url = `http://mysite.com/submit.?url=' + document.location.href;
url += '&anotherParam=foo`;
// etc.
You need to escape all parameter values accordingly.
I'd also recommend moving it into a function so your embedded JS doesn't become impossible to read.
Upvotes: 0