Skip to content

Instantly share code, notes, and snippets.

@RainerBlessing
Created July 28, 2009 15:39
Show Gist options
  • Save RainerBlessing/157460 to your computer and use it in GitHub Desktop.
Save RainerBlessing/157460 to your computer and use it in GitHub Desktop.
$.ajax({
url: '/categories.json',
type: 'get',
contentType: 'application/json;',
success: function(msg,a) {
$('#product_category_id').empty();
options="";
$.each(msg, function(){
options+= '<option value="'+this.category.id+'">'+this.category.name+'</option>';
});
$('#product_category_id').append(options);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// typically only one of textStatus or errorThrown
// will have info
this; // the options for this ajax request
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment