• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to call javascript function on body load using jquery

 
kranthi chamarthi
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic