klante
klante

Reputation: 51

crossdomain - Ajax

I need to call a wordpress page and show the page in a div tag on another webpage not using iframes etc. I have tried many different approaches like jsonp and so on, but i need a good example, keeps getting errors. I have full access to both domains.

Kind regards Mikael

Upvotes: 1

Views: 207

Answers (1)

Edyd Junges
Edyd Junges

Reputation: 127

Create an .htaccess on the domain you want to access with this:

Header add Access-Control-Allow-Origin "*" Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type" Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

Then you can use jQuery .load, for example, to get pages from the other domain.

Upvotes: 1

Related Questions