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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:28:56+00:00 2026-05-22T01:28:56+00:00

I am sure this is a basic one. I am not sure how to

  • 0

I am sure this is a basic one.

I am not sure how to describe this but when I press return in an input field it changes the URL to put the input name and value pair in the URL, e.g. for this code :

<form name="searchForm">  
<input name="searchTerm">  
</form>  

after having typed “fred” in the searchTerm field and pressed return, the URL changes to

test.html?searchTerm=fred

The thing is I have a submit button to do an XMLhhtprequest how do I stop this URL change?

  • 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-22T01:28:56+00:00Added an answer on May 22, 2026 at 1:28 am

    Just handle the submit event for the form. The easiest (but ugliest) way to do it is this:

    <form name="searchForm" onsubmit="return false">
    

    But since you have Ajax set up (which should be listening to submit anyways) use evt.preventDefault(); or return false; there instead. Also remember to only cancel when the request appears to have succeeded!

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

Sidebar

Related Questions

I'm not sure how to describe this, but I'll try with some basic code:
Not sure this is possible, but looking to write a script that would return
I'm not sure if I'm using standard terms, but this is a basic OO
Maybe this is a basic question. but I still not sure jquery cookie ,
Im sure this will be a simple one but have a project that started
Not sure this is a programming question, but we use LaTeX for all our
I'm sure this one is easy but I've tried a ton of variations and
I'm not even quite sure how to properly word this, but here goes. I
This is very basic I'm sure to JavaScript but I am having a hard
This, I'm sure is a pretty basic question about JavaScript, so apologies in advance.

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.