Retrieve $_GET through Java

Attempting to Retrieve GET through Java to update

Page 1 of 1

1 Replies - 3085 Views - Last Post: 08 April 2010 - 08:36 AM

#1 Guest_Devon*


Retrieve $_GET through Java

Posted 08 April 2010 - 02:17 AM

Hi Guys,
ive looked around the internet and i cannot seem to find or im just not using the correct search terms but here is what im trying to do.

I have a php doc that outputs a set of specific data via the $_GET function like so:

now this just out puts a one liner of code once its queried it from the server however im trying to up date a line oftext on my main site to try and get it to update using Javascript but i dont know how to pull the get data and store is in a var to use GetElementbyID?

Can any one help or pointme to a site were i can develop such a function?


Is This A Good Question/Topic? 0

Replies To: Retrieve $_GET through Java

#2 jrm402   User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 333
  • Joined: 18-March 10

Re: Retrieve $_GET through Java

Posted 08 April 2010 - 08:36 AM


I had the same problem, I couldn't use PHP's $_GET method to get the URL. So I wrote a Javascript function. I'm not just going to give you the code but I will help you.

1. You will need to store the url into a variable var url = window.location.href (Ok, I lied but that's all the code I'll give up :) ).

2. You need to get rid of the domain part of the url.

3. Explode the url into an array by the '&' symbol. This will give you an array containing the 'key value' pairs. Example params[0] = 'method=get', params[1] = 'data=ServerTitle'.

4. Next you need to explode each array value by the '=' sign.

5. Check to see that one of the parameters is the one you want.

6. Return the value of the correct parameter or false (so you can check an if statement if needed, i.e., if(urlParam('method')) { ... } else { ... } ).

Hope this helps. Post your code and we'll help you out! :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1