$("select[name=field[]]").live("change", function() {
$.getJSON("/json.php",{id: $(this).val(), ajax: 'true'}, function(j){
options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
});
$(this).siblings("[name=logic[]]").html(options);
});
So, I'd like to stick the result of the json callback (which it puts in options, a global variable) into a sibling of the object that is activating the event in the first place. The code I have above almost succeeds at this, but doesn't quite work because the callback doesn't happen instantly, so it sticks a blank string in the sibling. Thanks in advance and sorry if I got any terminology wrong there :)