unknown_routine
asked on
Jquery Load function does not work
I have this code:
But after clicking on button nothing happens. I also tried load("/a.txt"); Still no luck.
Tried different browsers, no success.
*Update*:
========================== ========== ========== ======
I managed to resolve the above issue(partially) by putting the files inside the Web server.
Now I have another related issue. Button that runs Jquery only seem to work only once. That is when I change the contents of the text file and click on the Button I always see the text of the old file. I suppose browser caches Jquery loaded data?
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("./a.txt");
});
});
</script>
</head>
<body>
<div id="div1"><h2>Let jQuery AJAX Change This Text2</h2></div>
<button>Get External Data</button>
</body>
</html>
enter code hereBut after clicking on button nothing happens. I also tried load("/a.txt"); Still no luck.
Tried different browsers, no success.
*Update*:
==========================
I managed to resolve the above issue(partially) by putting the files inside the Web server.
Now I have another related issue. Button that runs Jquery only seem to work only once. That is when I change the contents of the text file and click on the Button I always see the text of the old file. I suppose browser caches Jquery loaded data?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How is the a.txt changing from when you previously click the button? (and I don't mean just by you changing it)
Or you could call a single php file that includes the txt file.