0

for my mobile application I want to load HTML code dynamically into a container.

I tried the load method form jQuery but chrome is saying:

Origin null is not allowed by Access-Control-Allow-Origin.

My Code:

container.load("feeds.html");

I think this should be possible. Can you help me?

K. D.
  • 3,661
  • 7
  • 40
  • 65

2 Answers2

2

You cannot load() from a local source as there is no origin header provided. You need to change the logic to load jsonp if you want to do this.

Rory McCrossan
  • 319,460
  • 37
  • 290
  • 318
0

you cannot do CORS (Cross-Origin Resource Sharing). either you need to get values as Jsonp or a small work around from previous answers Origin Policy

use $.getJSON. It does a little magic to change the request type from its default of "json" to "jsonp" if it sees the substring callback=? in the URL.

Community
  • 1
  • 1
Ravi Gadag
  • 15,509
  • 5
  • 56
  • 83