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

The Archive Base Latest Questions

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

I want to stop the submit button in the js function checkUni() Usually in

  • 0

I want to stop the submit button in the js function checkUni()

Usually in js you can just return false, but that it not gonna work in my case because its an asynchronous (ajax)function, so the outer function will return before the inner function is able to determine wether to return false or true.

Here is the js function:

function checkUni() {
 var URL = "http://localhost:8080/GradSchoolApp/test.jsp";
  var container = document.getElementById("container_ID"); //destination of returned data
  var request = false;

  if (window.XMLHttpRequest) {
    request = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
    try {
        request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            request = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
        }
    }
  }
  request.open("GET", URL, true);

  request.onreadystatechange = function() { 
    if (request.readyState == 4) {
        //SOME CODE
                    //IF <something> then STOP SUBMIT BUTTON
        container.innerHTML = request.responseText;
    }
  }
  request.send(null);
}
  • 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:15:33+00:00Added an answer on June 4, 2026 at 7:15 pm

    Simply return false in the onclick listener.

    <input type="submit" onclick="checkUni(); return false;"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to stop (break) in the first function called whenever a submit button
$(#submit-button).click(function() { if($.trim($(#email).val()) === ) { $(.error-message-email).show(); } if($.trim($(#password).val()) === ){ $(.error-message-password).show(); } return
I want to stop click on any links until the page is loaded. Can
Microsoft seems to want us to stop using the MDI, but if more people
I want to put a form with input field and submit button inside a
I want to stop page submit on cancel action of confirm . What I
I want to call some web-service webmethods on asp.net submit button's click in order
I'm adding rows in a table with jquery but now I want to stop
<button type="submit" id="start-break" name="start" type="button" class="actv-btn-dft1 blbg" onClick="showhide('start-break', 'stop-break');return false;" title="Start Break">Start Break</button> <button
jQuery(function ($) { /* fetch elements and stop form event */ $(form.follow-form).submit(function (e) {

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.