Skip to content

Instantly share code, notes, and snippets.

@niczak
Created February 28, 2012 20:34
Show Gist options
  • Save niczak/1934929 to your computer and use it in GitHub Desktop.
Save niczak/1934929 to your computer and use it in GitHub Desktop.
jQuery .each example.
$("#email").bind("change", function(e){
$.getJSON("http://yourwebsite.com/lookup.php?email=" + $("#email").val(),
function(data){
$.each(data, function(i,item){
if (item.field == "first_name") {
$("#first_name").val(item.value);
} else if (item.field == "last_name") {
$("#last_name").val(item.value);
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment