javascript - Manually stop loading of php in jquery on load -


i have photos.php page getting called dynamically of jquery load function below :

 $("#photo_gallery").load("./photos.php" 

however want way manually stop loading of photos.php if user clicks button after above function call .

for example if user clicks button triggers $("#photo_gallery").load("./photos.php") , after exact next moment,if user clicks button,then above loading should stopped.appreciate if can me here.

     $("#photo_gallery).empty() not work here (it doesn't work while php page loads,it works when after/before load) 

in extension comment have this

var load = true;  $(document).ready(function() {      load_images(load); });   // recursively call load function long toggle true function load_images(toggle) {     if(toggle) {         $("#photo_gallery").load("next_image");         load_images(true);     } }  // toggle load button $('#toggle_load').on("click", function() {      if(load) {            load = false;            load_images(load);      } else {            load = true;            load_images(load);      } }); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -