I have a Java EE project that uses lots of html, javascript, java etc. I’m looking to use JQuery to load up an html template into a div tag however I’m unsure of where the relative path of the load method starts from.
The html file I’m trying to load is within the project but in a different directory. Would I have to back down and go back up to get to the path? And if there is an easy way to find out by some type of debugging methods of what the correct path is …. that would be BONUS! The javascript (JQuery) that its using is loaded in, the line below is also in another file. I have something like the following
$("<div id=\"eventMaintDialog\"></div>").appendTo($("body"));
$("eventMaintDialog").load("src\main\webapp\resources\js\template\Event\EventMaintTemplate.html");
I hope I explained this clearly. I feel like I keep changing the path but get nothing. I’m taking stabs in the dark. Thanks in advance.
Javascript runs in the browser, it has no knowledge of your Java EE project.
You can open up your browsers console and write this on the page to see:
It depends on the page’s url you are running the code on.
Note that
"\"is escape character in javascript strings. You probably wanted"/"there.