Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8574289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:26:28+00:00 2026-06-11T19:26:28+00:00

I am doing a gallery which has a function for navigating in between photos,

  • 0

I am doing a gallery which has a function for navigating in between photos,
next and previous.

Next and previous toggle plenty of asynchronous ajax calls so that there is the possibility to navigate in between photos fast.

Now here is my problem, assume I am at photo #1 and then I perform : next, previous, next, previous.

As the ajax calls are asynchronous then info retrieved for photo 2 ends mixed with info for photo 1 and so forth.

So I need to abort existing ajax calls at next and previous and then make the ajax calls.

I tried the following way:

var xhr=false;

function(){

if(xhr){   
xhr.abort();
}

xhr=$.ajax({

});

}

This does not do it, seems some requests are not aborted when rapidly going in between next and previous in my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:26:30+00:00Added an answer on June 11, 2026 at 7:26 pm

    The ajax() function returns a promise, so you could use done() to trigger the next ajax call. If the previous ajax call fails, done() won’t get called.

    Reference: http://api.jquery.com/category/deferred-object/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Gallery section which has Photos & Video section. I
i'm doing something of the sort of an infinite gallery. my OnScroll function detects
I'm working on a portfolio site, it has a gallery which is fixed up
I am doing an image gallery viewer, with little thumbnails, one medium-sized viewer, and
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I am building a simple photo gallery application which shows images in a listbox.
I am trying to load a swf file which contains xml based image gallery
I just followed an MVC tutorial on creating an image Gallery, which connects the
I have taken thumbnail image from gallery which is smaller in size and resized
I'm doing a cool fadey hover effect on a gallery of images to indicate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.