can’t get this tutorial working in localhost:
http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax1
my jquery.js file has the following code:
$(document).ready(function() {
// AJAX //
$("button").click(function() {
$("div").load('ajax.txt');
});
});
and the ajax.txt file is in the same folder, but no file is loaded.
What could be the problem ?
The load() function starts looking for a file in a root directory not in the same as the ajax file is. So with a code above your file ajax.txt should be in root folder. Otherwise change following line:
to:
or whatever folder tree you have, starting from site root folder!