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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:03:58+00:00 2026-05-19T03:03:58+00:00

I have a simple PHP page (for testing) that simply calls header(Location: http://www.example.com );exit;

  • 0

I have a simple PHP page (for testing) that simply calls header("Location: http://www.example.com");exit;, which resides on the same server, in the same directory as another file with the following jQuery Javascript:

$(document).ready(function() {
    jQuery.ajax({
        type : 'GET',
        url : 'bounce.php',
        error : function(xhr, status, error) {
            console.log("ERROR: ", xhr, xhr.status, xhr.getAllResponseHeaders());
        },
        complete : function(xhr, status) {
            // Get headers of the response
            console.log("COMPLETE: ", xhr, xhr.status, xhr.getAllResponseHeaders());
        }
    });
});

I was expecting (from several other StackOverflow responses) for the xhr.status to return “302”, but instead the AJAX call is triggering the “error” event (and then the “complete” event), and xhr.status is returning 0 (zero), and .getAllResponseHeaders() is coming back null (in both the error, and complete functions).

Firebug is showing the “302 Moved Temporarily”, and the response headers. So why is this triggering the error event, and not passing along the proper 302 code, and headers? Is this something to do with the Same Origin since the bouncing script and the fetching script are both on the same server? Is this jQuery or Javascript’s fault?

  • 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-19T03:03:58+00:00Added an answer on May 19, 2026 at 3:03 am

    I think the error is related to the browser security error. If you are not familiar with this, then you should know that using XMLHttpRequest you can only access files on the same server. So redirecting to example.com will result in an error because you are probably not on example.com.

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

Sidebar

Related Questions

I have a simple subscribe form at : http://thepanamainsider.com/sanblas/index9.php The form doesn't work, it
I have a simple php script on a server that's using fsockopen to connect
I have been writting a keyword search script based on this tutorial: http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/ Like
I have a very simple file upload PHP script. I am testing with a
I'm working on a PHP content management system and, in testing, have noticed that
I have a simple php page, with the main content placed in a table
I have a simple php page which outputs a table (which has been created
I have this simple php script <?php echo '<pre>'; // Outputs all the result
I am pretty new to php, but I am learning! I have a simple
I have some code I've written in PHP for consuming our simple webservice, which

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.