Forum Moderators: open

Message Too Old, No Replies

Can JavaScript or AJAX be used to reload page onclick?

         

dndco

4:33 pm on Oct 16, 2008 (gmt 0)

10+ Year Member



We have a Drupal based site using a Jquery photo gallery called Galleria.

The problem we are having is that we have lost a tremendous amount of page impressions due to the fact that a page does not reload as the user clicks from on image to the next.

The user views the photos via 'previous' or 'next' onclick function.

Is there a way to add a reload to that as well? So when the user clicks prev or next the URL advances and a new request/reload occurs?

I have been scouring the next and various forums and have not been able to get an answer.

Any help would be much appreciated.

rocknbil

6:06 pm on Oct 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Rather than that, I would use Ajax to send a request to your stats as if it had been reloaded, so as not to annoy your visitors. But using your method, it might get complicated - you can do location.reload() or document.location=some-value, but that's going to load the first picture. You'd need to figure out how to pass the "selected picture" value to the server so when it reloads it actually loads what they're expecting.

Demaestro

6:19 pm on Oct 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Playing devil's advocate for a second here.

Isn't the whole point of having an Ajax implementation so that you don't have page loads in this situation? If that isn't the reason you used Ajax here then ask yourself why are you using Ajax here.

Rather then hack Ajax to reload the page why not just not use an Ajax implementation?

rocknbil

2:08 pm on Oct 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm presuming the problem is because they are doing something like this . . .

<a href="next-img.jpg" onClick="viewframe.src='next-img.jpg' return false;"><img src="this-img.jpg" id="viewframe"></a>

(or the same thing with links along the bottom . . . )

Which only calls the image, not a page view.