0

I have a page that called redirect.php, this page has several attributes that I want to send them to another page, actually I write this code :

<script type="text/javascript">
        $.ajax({        
            url: "http://www.mysite.com/getdata.php",
            context: document.body,
            success: function(data) {
                $('body').append(data);
            }
        });
 </script>

But it does not work in firefox, in firefox not happens anything but in IE it worked. when I write exact name of page for example url: "getdata.php" it work perfectly but with absolute address is not :( Why it doesn't work in firefix? any idea? thanks for your help ...

2
  • 1
    Probably a same origin policy violation but I'm not sure why only Firefox. Are you browsing http://mysite.com/ in Firefox (no www)? Commented Oct 26, 2011 at 2:41
  • 1
    possible duplicate of PHP script returns error/nothing when fetching data with AJAX Commented Oct 26, 2011 at 2:43

1 Answer 1

2

It's a security restriction of Firefox not to allow cross-domain Ajax requests.

Sign up to request clarification or add additional context in comments.

2 Comments

Make sure you are pointing at a PHP document that is located on your server or localhost. It cannot be a subdomain either. It has to be in a sub or main folder for it to work
If you search Google for Firefox cross domain ajax there's quite a bit about it. Jonah's solution is best if possible, if you really need cross domain look into JSONP too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.