function contentDisp()
{
$.ajax({
url : "a2.php",
success : function (data) {
$("#contentArea").html(data);
}
});
}
<input type="button" value="Click" onClick="contentDisp();"> <span style="color:blue;">
<textarea id="contentArea" rows="10" cols="50"></textarea>
I'm new learning jquery.ajax now. I found some tutorial on the web. these are some code for control jquery.ajax when click a button, then load the content from a2.php
to div#contentArea
. I have some questions:
whether the js code can add a
jQuery(document).ready(function()
if I want open the page, load thehtml(data)
at onece, not a click callback?whether jquery.ajax can load a div's content form
a2.php
, not a whole page? similar jquery.load$("#contentArea").load("a2.php #content");
.
Thanks.