I have a simple index.html file to display a string from test.txt file using the .load function from jquery library and put the string content to html (div class="konten").
This the following HTML script :
<script type="text/javascript" charset="utf-8" src="js/lib/cordova-1.9.0.js"></script>
<script type="text/javascript" charset="utf-8" src="js/lib/jquery-2.0.2.js"></script>
...
<body onload="init();">
<div class="center">
<div class="konten"></div>
</div>
</body>
...
and the js :
$(document).ready(function(){
$('.konten').load('test.txt',function(responseTxt,statusTxt,xhr){
if(statusTxt=="success")
alert("External content loaded successfully!");
if(statusTxt=="error")
alert("Error: "+xhr.status+": "+xhr.statusText);
});
});
when I try to run the index.html file on the desktop browser (quick test), there is not displaying the content of test.txt, and showing the javascript alert Error: 404: error.
Is there anything wrong with the script that I wrote?
HTML editor : Eclipse 4.2.2 (Juno)
cordova-1.9.0
jquery-2.0.2