0

I wan't to know How to send data using GET to Java Script like from

link: C:/folder/test.html?x=1

<script>
//when page accessed
//access x data sent in from the link
</script>

Note, this is for client page not server!

2 Answers 2

1

Is this what you are looking for?

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

Comments

0

You need to parse location.search. A simple implementation would be:

var matches = null;
var params = {}, raw_params = location.search.substring(1).split('&');
for (i in raw_params)
{
    matches = raw_params[i].match (/^([^=]+)=(.+)$/);
    if (matches) params[matches[1]] = matches[2];
}

Comments

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.