some questions in load jquery.ajax -
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. found tutorial on web. these code control jquery.ajax when click button, load content a2.php div#contentarea. have questions:
- whether js code can add - jquery(document).ready(function()if want open page, load- html(data)@ onece, not click callback?
- whether jquery.ajax can load div's content form - a2.php, not whole page? similar jquery.load- $("#contentarea").load("a2.php #content");.
thanks.
if put ajax call in document ready run , load content immediately. how default tab on jquery tabs works.
jquery.load abstraction full ajax function. can .ajax can .load
as note, don't calling $.ajax() of it's parameters repeatedly, i've shown pattern here: showing loading image in modal popup extender in webservice ajax call
for purpose, however, following snipped load page on page load.
<script>   $(document).ready(function() {      $.ajax({       url: "a2.php"       ,success: function(data) {         $("#contentarea").html(data);       }     });    }); </script>  <textarea id="contentarea" rows="10" cols="50"></textarea>  
Comments
Post a Comment