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

  • Home
  • SEARCH
  • 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 8014531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:57:47+00:00 2026-06-04T19:57:47+00:00

I have an $.ajax() function that requests something with a string location. Assume result.location

  • 0

I have an $.ajax() function that requests something with a string location.

Assume result.location = “Somewhere” on the ajax response, but theoretically it could be any string.

On success(result) it does:

Line 1: alert("Hello There");
Line 2: alert("Look Here" + result.location); // Look here Somewhere

What happens is an alert box for “Hello There” pops up and “Look here” alert box is not shown until AFTER the user closes the “Hello There” alert box.

However, if for Line 1 instead of an alert I have a div instead of an alert box that shows up for example:

<div>Hello There <input type="button">OK</input></div>

So instead I have:

Line 1: showDivAlert();
Line 2: alert("Look Here" + result.location); // Look here Somewhere

Then what happens is the div shows up and the alert “Look Here” pops up. What could I put in function “showDivAlert()” such that any code below showDivAlert() will not get executed until the user clicks the “OK” button?

NOTE: key here is to preserve the result.location string of the ajax request

  • 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-04T19:57:48+00:00Added an answer on June 4, 2026 at 7:57 pm

    Change your HTML so that you have:

    <div>Hello There <input type="button" id="alert-ok">OK</input></div>
    

    Now you can target the button through the #alert-ok id.

    If you’re using jQuery, just attach an event:

    showDivAlert();
    $("#alert-ok").click(function() {
        //do work
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ajax call that fires multiple times but is called once. function
I have a jquery-ajax function that sends data to a php script and the
I have a javascript function that calls a generic function to make an ajax
I have the following code that works on Firefox and Chrome $("#adicionarItem").click(function(){ $.ajax({ type:
I have a div that is created by Ajax with .append(html) function, I'm trying
I have several ajax requests that return different values (pseudocode ahead) var foo =
I would like to have a function that returns the repsonseText of a jQuery.ajax()
I have a webservice function that returns something like the following: New Orleans, Louisiana
I have 3 $.ajax requests in a page that gets JSON content from the
I have an ajax function in jquery calling a php file to perform some

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.