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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:20:04+00:00 2026-06-15T13:20:04+00:00

Hashchange is for when index.php Changes to, say index.php#my-hash i.e. $(window).bind(‘hashchange’, function() { //

  • 0

Hashchange is for when

index.php

Changes to, say

index.php#my-hash

i.e.

$(window).bind('hashchange', function() {
  // do stuff
});

But is there an event for when there is a ? after the url, i.e.

index.php?id=foo&something_else=bar...

Edit

Okay, it’s when I submit a form. I submit the form and then the URL changes to

index.php?id=blah#my-hash

However I tried listening for a) the hashchange and b) the form submit:

$('form').submit(function() {
        go_to_signup_form();
});

Neither of which work (I think the page is refreshing?). I can’t alter the php too much because it’s part of a cms and I don’t want to break anything that’s happening in say, the controller class so I would rather just try to see when:

index.php

changes to

index.php?id=blah#my-hash

Edit #2
Thanks everyone for the feedback, got it working with:

if (url.indexOf("?") !== -1) {
    go_to_signup_form();
}
  • 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-15T13:20:05+00:00Added an answer on June 15, 2026 at 1:20 pm

    Nope, that is because the parameters (?foobar) aren’t usually used for client-side code. Linking to a new parameter on the same url (index.php -> index.php?foo=bar) makes your browser load a new page, while adding a hash (index.php -> index.php#foo=bar) does not make the browser transmit any data to the server.

    The hash section of a url, it’s a client-side piece of data. As such, it is useful to have a change event listener for it.

    Try these in your console, on a random site that doesn’t have a hash in the url yet:

    window.location.href += "?test"
    

    and:

    window.location.href += "#test"
    

    You will see that the first one will reload the page (Send a new HTTP request), the second one will not appear to do anything.

    To prevent a form from submitting:

    $('#target').submit(function() {
        // Your onclick code here
        return false; // Do not submit.
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using the following example for hash change: $(window).trigger('hashchange'); $('.navBtn').bind('hashchange',function(){ var hval = location.hash.slice(1);
I'm using http://benalman.com/projects/jquery-hashchange-plugin/ to listen for hash changes in my project, but his plugin
Is there a way to seperate a hashchange that occurs after a window.location.hash =
I'm using the jQuery plugin hashchange: http://benalman.com/projects/jquery-hashchange-plugin/ $(function(){ $(window).hashchange( function(){ // location.hash }) $(window).hashchange();
$(div#foobar).live('click', function() { }); $(window).hashchange(function() { }); How can I stop firing hashchange event
overlay.onclick = function(e){ e.preventDefault(); window.location.hash = 'overlay'; var close = function(){ //do some stuff
I'm trying to keep my hashChange event binding from bubbling. I have this: $(window).bind('hashchange',
I'm using this $(window).bind('hashchange', gotohash); to add deep linking to my app. My problem
I'm interested in using the JavaScript hashchange event to monitor changes in the URL's
I use to listen to hashchange handler event. But now with HTML5 you can

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.