0

My question is if there is anyway how i can load only a certain div like a text box from an different domain

Like :

I want to load The webpage Spiegelonline but i only want the .headline.

It would be even better if i can load classes not just ID´s

I tried it like this

<div id="asd"></div> $('#asd').load('crossdomain.html #content');

Jan Ackermann
  • 156
  • 2
  • 11

1 Answers1

0

This is unlikely to work. From the jQuery .load() documentation:

Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, port, or protocol.

CORS is a possible alternative. See How can I load content from another site onto mine with JavaScript/jQuery?

Community
  • 1
  • 1
Alex Wittig
  • 2,800
  • 1
  • 33
  • 42