1

I've got the following function

function make(point, name, message, type, file, id, lat, lng)

I want this function to pass all of these Javascript variables to a php file which would open in a window when a link is pressed how would I do this?

1 Answer 1

5
window.open('path/to/php?point=' + point + '&name=' + name); // etc for all other vars

make sure the values of your variables are urlsafe, i'd urlencode them with:

encodeURIComponent(variable);

Edit re your comment

<a href="#" onclick="make(vars, go, here); return false;">Click me!</a>

but if thats all you want, you might as well just have the link open in a blank window:

<a href="path/to/php?point=foo&etc=bar" target="_blank">Click me!</a>

It depends if make() is doing something else other than opening a window, i suspect so?

Sign up to request clarification or add additional context in comments.

1 Comment

How would I make this code only execute when a link is pressed?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.