submitting GET info without reloading ?
Moderator: General Moderators
submitting GET info without reloading ?
Hi,
Is it possible to submit info to a PHP script without reloading the current page.
I want to create a link with some GET variables, and the if people click the link, the GET info will be submitted, but the current page just stays on.
I want to do this because the page my visitor is looking at, is a large table in the backend of a database. Reloading it is unnecessary and costly.
Thanks, Michiel.
Is it possible to submit info to a PHP script without reloading the current page.
I want to create a link with some GET variables, and the if people click the link, the GET info will be submitted, but the current page just stays on.
I want to do this because the page my visitor is looking at, is a large table in the backend of a database. Reloading it is unnecessary and costly.
Thanks, Michiel.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Well yeah, I have read this. Maybe I misstated the question. I know it is not possible directly, but there is probably a workaround.
I know that the old audiogalaxy site was doing a similar thing. You could click on the satellite button, then the button would turn green, and the corresponding song was added to your queue, but the page was never reloaded. The button color was changed using javascript, but the song was added to the queue by a PHP script, which was called from a link on the button. However, I was never able to figure out how they did it exactly. Too bad the pages have changed now, otherwise you could take a look.
I will probably try to use a frame with size 0 and load an empty page into it.
Michiel.
I know that the old audiogalaxy site was doing a similar thing. You could click on the satellite button, then the button would turn green, and the corresponding song was added to your queue, but the page was never reloaded. The button color was changed using javascript, but the song was added to the queue by a PHP script, which was called from a link on the button. However, I was never able to figure out how they did it exactly. Too bad the pages have changed now, otherwise you could take a look.
I will probably try to use a frame with size 0 and load an empty page into it.
Michiel.
you could try creating a script that is basically a small TCP server using sockets in PHP, and then your page could send it a request (again using sockets) when the link was clicked. Basically, you'd have to get down and dirty, as I don't see an easy way to do it. Even if this solution is possible (probably) it wouldn't be very stable or scale up to a high volume of users. There's got to be another way, something more clever, but I'll be...ehm...darned... if I can think of it right now.
yeah, I already thought of using an (unvisible) applet, combined with some JavaScript. The point is, I have bad experience messing around with applets and javascript like this. A lot of browsers just won't eat it. Then it would be better just to move everything to a Java program or Java2 applet or so......
Hi galena,
Let me know if you find a solution to your problem.
I am wondering whether following would work:
- Call a javascript function when the link is clicked.
- Submit the GET info in the javascript function.
- Call the browser back action inside the javascript function
immediately after form is submitted.
Another option, is that once the GET info is submitted,
you can show the next page with message saying info was
submitted successfully.. and a link to go back.
If the user clicks the back link, you direct the browser back action.
Thus, the page will be re-loaded from cache, rather than from
the server.
Does this solve your problem ? Please let me know.
Ajay
Let me know if you find a solution to your problem.
I am wondering whether following would work:
- Call a javascript function when the link is clicked.
- Submit the GET info in the javascript function.
- Call the browser back action inside the javascript function
immediately after form is submitted.
Another option, is that once the GET info is submitted,
you can show the next page with message saying info was
submitted successfully.. and a link to go back.
If the user clicks the back link, you direct the browser back action.
Thus, the page will be re-loaded from cache, rather than from
the server.
Does this solve your problem ? Please let me know.
Ajay
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
i say you should use iframes..
Code: Select all
<form name="foo" target="bar"
<input type="text" name="example" value="blah" />
<input type="submit" />
</form>
<iframe src="blank.html" name="bar" height="0" width="0" />