-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
  • 4,982
  • 3
  • 27
  • 47
Mohammad Moghimi
  • 4,488
  • 12
  • 48
  • 74

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
  • 15,934
  • 3
  • 32
  • 66