Can anyone help me figure out how to make an ajax request from a page located in a subdirectory and receive a response? On my webpage, index.jsp
is situated within a subdirectory called /vf2
. In this page, there is a script file included:
<script src="../script/testscript.js"></script>
testscript.js
function getPlaceFromIP3(){
var ipAdd="1";
var params ="ipAdd="+ipAdd;
var resultStringX = $.ajax({
type: "GET",
url:"result_page.jsp",
data: params,
async: false
}).responseText;
alert(resultStringX);
}
The result_page.jsp
is located in the public_html
directory. However, when I call the function from index.jsp
, I receive a "page not found" error message. How can I send a request to a page in the main directory from a subdirectory?