.load() method in jquery give me 404 - Not Found error

前端 未结 1 1330
感情败类
感情败类 2021-01-16 07:17

I have a simple page that I need to load .html file to a DIV ,but I always have 404 NOT FOUND

I have a file called demo_test.txt in the same folder of my JSP file,I

相关标签:
1条回答
  • 2021-01-16 07:57

    Like Claudio Redi said...

    you're trying to load a file relative to the path you are at. Try hard coding the file path and then viewing it your browser and then it should load.

    so your line will be like this (if file is located in WEBROOT /MY_APP/Files)

    $("#div1").load("/MY_APP/Files/demo_test.txt", function(responseText, statusText, xhr)
    

    or the full path

    $("#div1").load("http://MyWebsite.com/MY_APP/Files/demo_test.txt", function(responseText, statusText, xhr)
    
    0 讨论(0)
提交回复
热议问题