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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:51:38+00:00 2026-05-13T10:51:38+00:00

I have a simple Ajax script that works perfectly fine in Chrome, Internet Explorer

  • 0

I have a simple Ajax script that works perfectly fine in Chrome, Internet Explorer 8, Firefox 3.5.5 but fails in Firefox 3.5.7. The code is as follows:

HTML Page:

<div>
  <form>
    <input id='button' type='button' value='click'>
  </form>
</div>

<script>
  $(document).ready(function(){
    $("#button").click(function(){
      $.ajax({  
        type: "POST",  
        url: HTTP_HOST+"/ajax/ajax.php",  
        data: 'source=test',
        dataType: 'html',
        success: function(data) {alert('success: '+data);},
        error: function(XMLHttpRequest, textStatus, errorThrown){alert('fail:\n'+
                                                                 textStatus+'\n'+
                                                                 errorThrown+'\n'
                                                                 );}
      });
    });
  });
</script>

ajax.php page:

$sourcePage = $_POST['source'];
if($sourcePage == 'test'){
  echo 'hello';
}

I get the expected response (an alert box saying ‘success: hello’) in the browsers I mentioned above. In Firefox 3.5.7, however, I get the alert box with ‘fail: error undefined’.

Using Firebug‘s Net panel I can see the Ajax calls and they get a response value of 200 OK although it can’t seem to distinguish the size of the response.

There are no other errors according to Firebug.

Based on the apparently successful Ajax call and the undefined size of response, I’m assuming Firefox is having trouble interpreting the response though I’m new to this and have no idea what to try.

How can I solve this problem?

  • 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-13T10:51:38+00:00Added an answer on May 13, 2026 at 10:51 am

    I found what the problem was. Basically what was happening is my HTML page had an address of http://domain.com.au/testPage.php but my Ajax was calling http://www.domain.com.au/ajax.php. There must be some type of security setting that complains when you try to make an Ajax call to a different domain?

    So if I access the page as http://www.domain.com.au/testPage.php then it works. Also, if I change the Ajax to call http://domain.com.au/ajax.php without the www, and make the call from http://domain.com.au/testPage.php that also works.

    Basically make sure the sub-domain of your page is the same as the sub-domain of the page you’re requesting with Ajax.

    This could potentially be a big problem for people who don’t realise this as a lot of hosting packages (like mine) will serve you the same page with or without the www sub-domain by default. As such it is possible for me to access all of my pages with or without the www and not notice a difference (except that Ajax won’t work).

    It appears as though the other browsers have the same problem which means that it was a terrible fluke that every time I tested Firefox (on 5 different systems) I somehow ended up trying the URL without the www 🙁

    I’ll have to look into finding a way of forcing everyone to use the www sub-domain. I believe http://www.thesitewizard.com/apache/redirect-domain-www-subdomain.shtml#domaintosub is what I’m looking for.

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

Sidebar

Related Questions

I have a simple load more style script that works fine on the index
I have a 2 ajax functions on my page. One that works when a
I have a simple reporting script that takes 5-10 minutes to run. It's triggered
I have seen simple example Ajax source codes in many online tutorials. What I
I had a realtivley simple ajax application, which I have broken up to be
I have a simple HTML. I am using the JQuery for AJAX purpose. Now,
Should simple JavaBeans that have only simple getters and setters be unit tested?? What
I have a simple webform that will allow unauthenticated users to input their information,
I have a simple 2-column layout with a footer that clears both the right
I have a relatively simple example of an MVC page that is using jQuery

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.