I have my iframe such as this:
<iframe src="http://api.example.com/html/31" id="fa-iframe" scrolling="No" frameborder="0" style="height: 513px; width: 597px; "></iframe>
and a javascript like this:
$.get("/inc_appdl_main.php", { id=args },function(data) {});
The website is http://example.com …
I want to reach this file in my directory inc_appdl_main.php.
However, when I do the request,.. the internet doesnt allow me cause it interprets:
http://example.com
and
http://api.example.com
as two seperates domains..although both are the same sites..with a different url. api is simply a folder that the get request gets to.
I have two options to use in my get.
Either..
.get(" http://api.example.com/inc_appdl_main.php", { id=args },function(data) {});
which will give me “404”
or
.get(" http://example.com/inc_appdl_main.php", { id=args },function(data) {});
which will give me an error that I cant post across domains
Although the site is the same site, the url is different.. and I need to get to this file..
inc_appdl_main which sits on the same root directory...is there a way?
A couple of possible solutions:
Configure your server so that it can accept the request for
http://api.example.com/inc_appdl_main.php, processing it as though it werehttp://example.com/inc_appdl_main.php". This is probably the easiest, as you’re in control of the server.If the response from
api.example.comis an HTML page, add JavaScript to it to setdocument.domaintoexample.com.Require that your users use a Cross-Origin Resource Sharing (CORS) compatible browser and reply to the CORS preflight requests and such on the server.