File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes how to call javascript function on body load using jquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to call javascript function on body load using jquery" Watch "how to call javascript function on body load using jquery" New topic
Author

how to call javascript function on body load using jquery

kranthi chamarthi
Ranch Hand

Joined: May 08, 2007
Posts: 95
Hi,
I am using jquery $(document).ready function and in that i have some jquery ajax code that brings some required data from server. Now problem is, the ajax request is going to backend when the page is loaded for first time. But when user navigates to another link and click on back button of the browser the ajax request is not going. I want ajax request to be made each time when control comes to page. I am not sure whether the 'ready' function of jquery runs only once when page is loaded for first time or it runs each time when the control moves to respective page. Please suggest me some solution.
Thanks
Kranthi
kranthi chamarthi
Ranch Hand

Joined: May 08, 2007
Posts: 95
I have kept an alert statement in my $(document).ready function and it is getting printed every time the control comes to the page, problem is with jquery ajax code...the ajax request is not going to server when control comes to the page again and again..What might be the reason for this.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Are you cached? That is what get requests are supposed to do. Fiddler or any other proxy should show you what happens with the http request.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call javascript function on body load using jquery