hello Whenever I click on the button that says "Get External Content" I get a javascript alert that says "Not Found" (this is the error's status text).
Why can it not find the text file I am trying to load via ajax?
This is my folder hierarchy:
--public_html
--app
--ajaxTestHome.php
--ajaxTestText.txt
And this is the file I am trying to load (via ajax) the text file into.
//ajaxTestHome.php
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#ajax").click(function(){
$.ajax(
{
url:"/app/ajaxTestText.txt",
success:function(result){
$("#div1").html(result);
},
error: function(abc) {
alert(abc.statusText);
},
cache: false
}
);
});
});
</script>
</head>
<body>
<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>
<button id="ajax">Get External Content</button>
</body>
</html>
EDIT: I had a typo in the question. the file is called "ajaxTestText.txt" not "ajaxTestTest.txt"