0

Possible Duplicate:
Cross Domain Ajax Request with JQuery/PHP

I hope you can help I have a php page on a subdomain which onclick needs to execute a PHP script on the main domain with a GET request. For some reason

$.get("http://www.domain.com/page", {param: param}, function(data){alert(data);});

Is returning a 404 error. The page is definiately there and will run when the url is entered directed.

Any help would be much appreciated. Thanks Mark

0

3 Answers 3

2

Look up the Same Origin Policy and JSONP

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

Comments

0

I believe the problem is that you are trying to load a file directly off of another origin. Browsers prevent this (making you get a 404 error).

You can read about the exact details here:

http://en.wikipedia.org/wiki/Same_origin_policy

Comments

0

add this to your php files:

header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.