-3

I'm trying to load a local html file in a div when a certain pressed with the following jquery load command.

$("#div_name").load("local_html_file");

But I'm getting the following error.

MLHttpRequest cannot load file:///path/to/file.html. Received an invalid response. Origin 'null' is therefore not allowed access. 

I'm not running any special servers. Just running my html files with Chrome. I searched it and kind of know what the problem is but don't know how to solve it.

Clément Malet
  • 5,062
  • 3
  • 29
  • 48
Mohammad Moghimi
  • 4,636
  • 14
  • 50
  • 76

1 Answers1

1

Jquery .load() method is an ajax call.

That's why it will not work locally... You need to run it on a server that will accept HttpRequest's.

It's been discussed before:

Community
  • 1
  • 1
LcSalazar
  • 16,524
  • 3
  • 37
  • 69