tags:

views:

277

answers:

6

How do I send an HTTP GET request without a form? This request is performed on a web page.

For more details on what I'm trying to accomplish and why, see my question here: http://stackoverflow.com/questions/745217/http-get-post-request-and-google-geolocation-api

+1  A: 

You can use Ajax and jQuery's get method:

$.get("someURL.php?variables=true");

Note, that you will only be able to make requests to the same domain OR the target domain must return JSON formatted results.

altCognito
+7  A: 

Any link is a GET request, so, just make a link, add the extra info at the end, done.

http://someurl.net/somelink?value1=avalue&value2=anothervalue

James Black
+1  A: 

In plain HTML you can do that e.g. requesting an image:

<img src="http://example.com/?bla=bla"&gt;
vartec
+1  A: 

A normal hyperlink does a GET request when the user clicks on it. Loading an image is also a GET request, as are most of the other ways of embedding things in a page. If you're trying to do it via JavaScript, you can use an XMLHttpRequest.

rmeador
+1  A: 
< a href="www.google.com">google</a>
Warrior
+1  A: 

I agree with altCognito points out using jquery but I'd rather use

$.get("someurl.php", { variable: value });

I like this way better because it allows me to send objects instead of concatenate strings. you can see a couple of samples here

Eugenio Miró