I wrote this script but it think something is wrong with the syntax since it wont execute could you please tell me whats wrong?
<script type="text/jscript">
var subcategoriesUrl = '@Url.Action("GetSubCategories")';
var subcategories = $('#SelectedSubCategory');
$(document).ready(function () {
$('#SelectedCategory').change(function () {
subcategories.empty();
$.getJSON(subcategoriesUrl, { idSubCategory: $(this).val() },function(data) {
if (!data) {
return;
}
subcategories.append($('<option></option>').val('').text('Hello'));
$.each(data, function(index, item) {
subcategories.append($('<option></option>').val(item.Value).text(item.Text));
});
});
});
});
});
</script>