javascript - $.get() method JQuery reads nothing (html) -
goal:
when click_div clicked, script should read file (text.html) own computer using $.get() method, , set html of div (cont_div) file's content.
code:
$(document).ready(function() { $('#click_div').click(function(){ var html_file_url = 'text.html'; $.get(html_file_url, function(data){ alert(data); $('#cont_div').html(text); }); }); });
problem:
the content of cont_div keeps blank, after clicking click_div. put alert show content of method read, , displays blank dialog.
further information:
• file on same folder .js file, , index.html page file.
• other javascript functions work well.
question:
given alert function displays nothing, still called, possibly doing wrong? i've tried many things, doesn't work.
this should it
/text.html
<p>lorem ipsum dolor</p>
/something.html
<script type="text/javascript"> $(document).ready(function() { $('#click_div').click(function(event){ $('#cont_div').load('/text.html'); }); }); </script> <div id="#click_div">click</div> <div id="#cont_div"></div>
Comments
Post a Comment