jQuery load and get

Using get in jquery:
$.get(url, function(data) {
var data = $(data);
//do something about gotten data before load it to #div
$(“#div").html(data);
});
will allow changing the result gotten from the url. the function will be used to process the resulted data before loading into the #div element

Using load in jquery:
$(“#div").load(url, function() {
$(this).find(“.class").remove(); //processing element loaded
});
will allow you to change the loaded element #div or others after loading. This is for POST-processing.

廣告
Posted in 未分類