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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:07:35+00:00 2026-05-13T23:07:35+00:00

Let me first put the code snippets here. I am just using the ASP.NET

  • 0

Let me first put the code snippets here. I am just using the ASP.NET MVC project Visual Studio creates out of the box. So I am just putting the snippets I added to it:

Site.master’s head section:

<head runat="server">
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
    <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/test.js" type="text/javascript"></script>
    <script type="text/javascript">$(document).ready(ready);</script>
</head>  

Content of test.js:

function ready(){
 $.get("/Home/TestAjax", ajaxResponse);
}

function ajaxResponse(data){
    alert("got response from server: " + data);
}

Method in HomeController:

        public String TestAjax()
        {
            if (Request.IsAjaxRequest())
            {
                return "Got ajax request!";
            }
            else
            {
                return "Non-ajax request";
            }
        }

Now the problem I am seeing in Firefox 3.5.30729 (Firebug) is when the ajax request goes out, IIS 7 on the remote box sends Http 302 back, which does the redirect and forces another get request, but it is not asynchronous. Opera also doesn’t work so I assume it is the same problem. However, above code works just fine in IE 8, Chrome, and Safari.

On localhost all of the above browsers work as expected including Firefox and Opera — they all receive “Got ajax request!” as the response from the server.

Anybody have any ideas what’s going on here and how to fix it? I am looking for a real solution or at least explanation as to what is going on and why.

  • 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-13T23:07:35+00:00Added an answer on May 13, 2026 at 11:07 pm

    So playing with Fiddler did help figure out this issue. Here is what was happening:

    The URI in $.get call was causing it to not find the action method, which I indicated in my question that the server was returning a 302. Once Firefox (and Opera) got a 302 from the server, they both tried using “/Home/TestAjax/” (with a slash at the end). However, this time the HTTP header didn’t have X-Request-With set to “XMLHttpRequest”. So in TestAjax() action method Request.IsAjaxRequest() was false, hence I got “Non-ajax request” back as response.

    On the other hand, the reason why IE, Safari, and Chrome were working is because they still had X-Request-With set to “XMLHttpRequest” in redirected request. It is still a mystery to me as to why Firefox and Opera didn’t, but I am not going to worry about it at this point.

    Quite silly of me to overlook the ending forward slash, but I had no idea it held such importance!

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

Sidebar

Ask A Question

Stats

  • Questions 375k
  • Answers 375k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer By default, my Visual Studio setup has CTRL+R, T mapped… May 14, 2026 at 8:16 pm
  • Editorial Team
    Editorial Team added an answer It could be as simple as just using hover. http://jsbin.com/ojipu/2… May 14, 2026 at 8:16 pm
  • Editorial Team
    Editorial Team added an answer No, there is not a better solution. If you are… May 14, 2026 at 8:16 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.