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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:07:15+00:00 2026-05-18T03:07:15+00:00

I have just entered the world of jquery and am pretty new to javascript

  • 0

I have just entered the world of jquery and am pretty new to javascript too. I have a small javascript snippet like below:-

<script type="text/javascript">
 $(function(){
    $('a').click(function(event){
        event.preventDefault();
        $.get('/_add_navigation_',function(response){
        $('#themaincontents').html(response);
        })
   })
</script>

The html looks like this:-

<a href="?toaddnavigation">CLICK Me</a>
<div id="themaincontents"></div>

On the server side I do an xhr header check by something like

 if request.is_xhr: send response else:redirect somewhere

Now while this code works fine on Chrome and Opera, on Firefox it is behaving a little weird. The server does not send back the reponse, but rather does a redirect. That means it says that there is no xhr header. Why should this happen while on the other two browsers it is working fine?
(I am using Firefox 3.6.12)
Update – I just had a look at the request headers of Firefox and I find no X-Requested-With:XMLHttpRequest header, but it is present in Chrome.

  • 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-18T03:07:15+00:00Added an answer on May 18, 2026 at 3:07 am

    Not all browsers send the same headers, and you cannot rely on them to be consistent across browsers. The easiest way is to not rely on the browser to send something, but manually send something yourself:

    $.get('url', {
        xhr: 'yes' // add this extra parameter here
    }, function(){
    
    });
    

    then check for that GET variable on the server instead of a header that may or may not be sent by a browser.

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

Sidebar

Related Questions

I have just entered in the world of OpenX, and as figured out that
I have just entered the world of coding and am learning all about loops.
I have just started on event bubbling in jQuery so my understanding is very
I have just entered into the Blackberry Arena. Now I am ready for the
I have a code in javascript and I am using jQuery Calculation plugin (can
I'm super new to jquery and just stractching the surface of its awesomeness so
I have no previous experience with Javascript/JQuery/AJAX and I was given a task on
Hi I am new to Jquery and struggling with parsing XML. I have a
I have just entered into the Grails arena. I have a requirement where I
I have the following jquery code: $(document).ready(function() { $('button').click(function() { $.getJSON('http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/server/status?output=json', function(json) { alert(Entered

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.