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.
  • 4,041
  • 9
  • 48
  • 72

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
  • 331,213
  • 40
  • 305
  • 339
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,735
  • 5
  • 57
  • 83