Suresh Atta
Suresh Atta

Reputation: 122008

Including php page in html page

Here I'm trying to access some php page in html page. Both running on different servers one is on WAMP server and I can see the page in browser when I hit

http://localhost:8080/winnersphp/index.php

Now I'm trying to access that page in ajax load like in another html page running in different server (in Eclipse , which is jetty server (java)) in localhost and the page URL is

http://localhost:8888/includephp.html

and in this html page I'm using Jquery

<script>
    $( document ).ready(function() {
    $("#externalHeader").load("http://localhost:8080/winnersphp/index.php");
    });
</script>

But no luck. Is there any security issues ?? or domain issues ??

Initially I thought about some domain issue, but both running on localhost. Port causing any problem here ?

Can some one point me what I'm missing here ?

Upvotes: 0

Views: 60

Answers (1)

Nate Kibler
Nate Kibler

Reputation: 652

Looks like jQuery's .load() method is similar to the .get() function, which is subject to the same origin policy. This does, indeed, restrict against different port numbers.

If you can use JSONP, though, you can still accomplish your task by following this answer: https://stackoverflow.com/a/2099771/2482557

Upvotes: 1

Related Questions