html - ajax load not loading textfile jquery -
jquery load doesn't load text file ... want load text file on click ...its sampl e program
<div id="page"> <h1>demo page - how load page div via ajax using jquery? </h1> <table border="1" cellpadding="5" cellspacing="3" width="30%"> <tr> <td> <a href="javascript:void(0)" id="loadpage">click load web page</a><br /> </td> </tr> <tr><td></td></tr> <tr> <td><div id="pagecontainer" /></td> </tr> </table> </div> <script type="text/javascript" language="javascript"> jquery(function(){ jquery('#loadpage').click(function(){ jquery('#pagecontainer').load('sample.txt'); }); }) </script>
there must error somewhere (is sample.txt
file in same path page?) or jquery not loaded. working fine me:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script type="text/javascript"> $(function() { $('#loadpage').click(function(){ $('#pagecontainer').load('text.txt'); }); }); </script> <a href="#!" id="loadpage">load</a> <div id="pagecontainer"> here </div>
check out jsfiddle
you may want put alert()
after $(function(){
see if jquery loaded , working; should pop alert on page loaded.
in case, post more of code.
Comments
Post a Comment