jQuery and asynchronous response -


<script> $(document).ready(function(){   $("#bb").click(function(){     $("#temp").hide();  });    $("button").click(function(){     $.get("demo_test.asp",function(data,status){       $("#aa").html("<div id=temp>"+data+"</div>")          });   });  }); </script>  <button>clik</button> <button id=bb>bb</button> <div id=aa></div> 

url: http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_get

why cant control element id=pom returned .get function using $("#bb").click?? why page doesn't work??

please make sure add jquery script code:

verify console of browser , check error. access-control-origin problem common when testing sort of code.

note set "test.html" same file. save script "test.html" , work on desktop example.

here code working:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){   $("#bb").click(function(){     $("#temp").hide();  });    $("button").click(function(){     $.get("test.html",function(data,status){       $("#aa").html("<div id=temp>"+data+"</div>")          });   });  }); </script>  <button>clik</button> <button id=bb>bb</button> <div id=aa></div> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -