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 9060679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:17:30+00:00 2026-06-16T15:17:30+00:00

I have a strange issue in JQuery AJAX.. My Steps sequence are as follows:

  • 0

I have a strange issue in JQuery AJAX..

My Steps sequence are as follows:

1) I have a JS Function which I am calling on Button Click Event:

 function Click()
 {

    //I am performing some Validations then making an AJAX Request:

   $.ajax({
      type: "POST", 
      url: url, 
      context: window, 
      data: datatoPost,
      contentLength: contentLength, 
      async: true, 
      success: function (response) { 
          callbackFn(response); 
       },
      error: function (msg) { 
          this.error = msg;
       }
    });

   // The callback function is called on Successfull AJAX Request 
   // i.e. callbackFn (See below)

   // I am then checking the window.IsValid which I have set in below function;

   if (window.IsValid == true) {
           // Then Perform another AJAX Request
     }
     else {
         // do nothing
     }
  }


  function callbackFn(response)
  {
     if(response == 'Valid')
     {
         window.IsValid = true;
     }
     else 
     {
         window.IsValid = false;
     }
  }

2) Now, The Problem is while server is processing the First AJAX Request then the code written after that i.e.
if (window.IsValid == true) {
// Then Perform another AJAX Request
}
else {
// do nothing
}
}
is executed

3) I get window.IsValid = false as first AJAX Request’s callback function i.e. callbackFn(response) is not called yet and Even after a Valid response of first AJAX request my second ajax request is not getting executed as window.IsValid variable is not still got set in callback function as callback is not called yet due to server is processing the request.

Please help me I am stuck..

  • 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-16T15:17:31+00:00Added an answer on June 16, 2026 at 3:17 pm

    you should then use

    async: false,
    

    in you ajax function call. Which is not recomended. The better thing will be to use

    if (window.IsValid == true) {
               // Then Perform another AJAX Request
         }
         else {
             // do nothing
         }
      }
    

    within your callback function.

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

Sidebar

Related Questions

I have a strange issue with jQuery's hover, addClass $(document).ready(function(){ $('#selectable li').hover( function(){ $(this).addClass('selecting',
I'am building simple Ajax application (via jquery). I have strange issue. I found where
I am facing a strange behaviour in jQuery 1.4 with the click event. The
Having a strange issue with the TabContainer in the AJAX Toolkit. We have several
I have a strange JQuery issue that I am looking for help with. I
I have a very strange issue with the jQuery Validation plugin where it won't
I have some strange issue using jQuery Validation plugin. Firs of all here is
I am currently stumped on a strange issue. I have a jQuery slider that
I have a very strange issue with JQuery, its about a starting of JQuery
I seem to be having a strange jQuery issue. On my page I have

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.