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();">&nbsp;<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:

  1. whether js code can add jquery(document).ready(function() if want open page, load html(data) @ onece, not click callback?

  2. 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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -