JQuery - unable to load if not on a web server

I am trying to download a page from my desktop, name it as loadme.htm .

Now I have an index.htm file that loads loadme.htm .

Why can't it load when I open index.htm from my desktop? Some jQuery functions work here as .trim() , .show() , etc. But if I put it on WAMP, it will load successfully.

Edit: this is how I load "loadme.htm" $.("#content").load("loadme.htm");

+4
source share
1 answer

I assume that you used the jquery ajax upload function to upload your file. This will not work if you are not using an http call for this. When you open from the desktop, it uses the file protocol and does not work. Other jquery functions, such as trim (), show (), work because it does not depend on the type of protocol, and the browser itself can handle these calls.

+6
source

Source: https://habr.com/ru/post/1438743/


All Articles