Intro to jQuery with John Resig


Some codes from the video.



jQuery("div").load("url") // is the same as
jQuery.ajax({
url: "test.html",
complete: function(h) {
jQuery("div").html(h);
}
});

// only extract h2
jQuery("div.load").("file.html h2") // and it is the same as
jQuery.ajax({
url: "test.html",
complete: function(h) {
jQuery("div").html(
jQuery(h).find("h2"));
}
});
// To get external script
jQuery.getScript("somescript.js", function(){
});
jQuery(document).ready(function(){
});

// for async
jQuery.ajax({
url:"somescript.js,
async: false
});
//example
jQuery(document).ready(function(){
jQuery("form").ajaxForm(function(html){
jQuery("#item").val('').focus();
jQuery("ul").html(
jQuery(html).find("li");
});
});

Related Posts :



blog comments powered by Disqus
 
^ Scroll to Top