Skip to content

Instantly share code, notes, and snippets.

@JustinK
Last active August 29, 2015 14:08
Show Gist options
  • Save JustinK/43dce024d741f9f05a43 to your computer and use it in GitHub Desktop.
Save JustinK/43dce024d741f9f05a43 to your computer and use it in GitHub Desktop.
$('#cboCategory').change(function () {
var categoryId = $(this).val();
loadTypeList(categoryId);
});
function loadTypeList(categoryId) {
$.ajax({
type: 'POST',
url: 'Example.aspx/GetTypeList',
data: '{categoryId: "' + categoryId + '" }',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (response) {
loadList(response);
},
failure: function (response) {
}
});
function rebindTypeList(data) {
$('#cboType').get(0).options.length = 0;
$('#cboType').get(0).options[0] = new Option('select type','');
$.each(data.d, function () {
$('#cboType').get(0).options[
$('#cboType').get(0).options.length
] = new Option(this.Name, this.Id);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment