JQuery .each Against a Variable -


how 1 specify target variable jquery each function? performing request , placing results in variable. want run each function on variable pull out id tags. many thanks.

$.get("somepage.php?id=45 #my_target_div", function(data) {    $.each(function(data, "#id") {    }); }); 

the $.get() method doesn't allow filter down results selector .load() does, , use of .each() wrong.

this allow loop through elements have id attribute inside my_target_div.

$.get("somepage.php?id=45", function(data) {        $("<div />").html(data).find("#my_target_div [id]").each(function(){        // annoying alert        alert(this.id);        // or more appealing console log        // console.log(this.id);    }); }); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -