can I use event load offline with text file

2019-09-02 11:18发布

问题:

I want to load a div which I have saved as plain text(file). I have this file in the same root as my HTML page. On my HTML page I'm trying to call this file with Jquery event load, like this:

$("#tab2").load("textfile");

It doesn't work. Is it necessary to do this online, on a server? I'm I doing something wrong saving it as a text file? Should I save as html, how would this look like in the code?

回答1:

Load data from the server and place the returned HTML into the matched element.

ref: http://api.jquery.com/load/

yes it has to be on the server



标签: jquery load