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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:43:43+00:00 2026-05-26T21:43:43+00:00

I have a strange bug where I am doing an ajax load from an

  • 0

I have a strange bug where I am doing an ajax load from an input. I realize that this may be a stupid way but it was the only way I found to get IE to cooperate with using the enter key. I then had a separate issue of where the submit in IE kept opening a new window rather than just using Ajax GET. So.. I ditched the form altogether and I am trying to do everything with javascript.. something like this :

<input class="myInput" type="text"></input>
<img src="submitbutton" class="submitIt" />

I am starting the ajax function with :

$('.submitbutton').click{function() { ajaxFunction(); });

which works fine.

and also when the user hits enter:

$('.myInput').keydown(function(e){
if (e.keyCode == 13) {
ajaxFunction();
return false;
}

which works.. for the first entry. But then if you enter a second number it makes that ajax request 2 times, a third number = now 3 simultaneous ajax requests to the same place are happening, ad infinitum …

I am pretty sure the problem is the wacky way I set up validation. The keydown function is in an else {} statment like this and will not work until there are exactly 9 numbers in the input.. here is part of it :

    if ( len !== 9 )
        {
            if ( len == 1 )
            { y.hide(); n.show(); valInput.text("You need 8 more numbers");
            } 
            else                            
                {
                if ( len == 2 )
                { y.hide(); n.show(); valInput.text("You need 7 more numbers");
            }
            ...
         } 
     else {
    $('.myInput').keydown(function(e){
    if (e.keyCode == 13) {
    ajaxFunction();
    return false;
    }

}

Sorry I dont have live code that is accessible and it would take me a while to set one up but if that is what needs to happen I will do it.

  • 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-05-26T21:43:44+00:00Added an answer on May 26, 2026 at 9:43 pm

    I have a strange bug where I am doing an ajax load from an input. I realize that this may be a stupid way but it was the only way I found to get IE to cooperate with using the enter key

    Might be the IE version you are using. But hitting the enter key triggers a submit here.

    I then had a separate issue of where the submit in IE kept opening a new window rather than just using Ajax GET. So.. I ditched the form altogether and I am trying to do everything with javascript.. something like this :

    You should really need to find out why that happens in stead of trying to write hacks. It’s part of the game as well as the learning process as well as it is just the way to do it.

    Why don’t you just use .submit() and a ‘normal’ submit button like:

    <form action="#">
        <input type="text" name="myInput">
        <input type="image" src="submitbutton" class="submitIt">
    </form>    
    
    $(function() {
        // use this instead of clicking on submit or enter key pressed
        $('form').submit(function() {
            // get character count of input
            var char_count = $('input[name="myInput"]', this).val();
    
            // validate it
            if (char_count != 9) {
              // still need to initialize y, n and valInput
              y.hide();
              n.show();
    
              // watch out this may give negative numbers
              // this will take care if the error to be displayed. way better than using lots of ifs :)
              valInput.text('You need '+parseInt(9-char_count, 0)+' more characters');
    
              return false;
            }
    
            // can be uncommented if you still want to use AJAX to submit your form, but really it is not needed.
            //ajaxFunction();
            //return false;
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have this strange bug report from a customer: Log file last modification date
I have a strange bug when trying to urlopen a certain page from Wikipedia.
I have a rather strange bug which i can't make sense of that is
I have a really strange ‘bug’. I use this in my view: <% foreach
I have a strange bug in resharper 4.5 in VS 2005. Instead of doing
I have a strange bug that appears to happen only when the program isn't
I have written some code that works pretty well, but I have a strange
I have a very strange bug in a shipping iPad/iPhone app that I can't
I have this strange bug in Safari Mac. When I use CSS columns (-webkit-column-count),
Here is the pattern: $urlpattern = '%[^http://][^https://][\w]+(-[\w]+)*(\.[\w]+(-[\w]+)*)*\.[\w]{1,6}(\.[\w]{1,6})*[^/]%'; I have encountered a strange bug that

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.