Is there away to load a page only once with AJAX?

Posted by digitup on Stack Overflow See other posts from Stack Overflow or by digitup
Published on 2010-05-02T09:53:06Z Indexed on 2010/05/02 9:57 UTC
Read the original article Hit count: 151

Filed under:
|

I have an AJAX call to load a function once the page is loaded, the function opens a lightbox a like frame with some data. The issue is that if I click on close (lightbox frame), the page loads again and again loading the frame so the use never reaches the page under the layer of frame since the frame load on infinite loop. The Ajax is repeating calling the function I guess but I would like to load the frame once and when the user clicks X (close) he may return to the original page.

$(document).ready(function(){
var city = $('#citycode').html();

$.ajax({
//when page is loaded, fire the following function
success: function(){
//the function to be fired located in the page in seperate file
openX(city + //some other parameters);
}});


});

Any tips?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX