Reloading The Subcategory Depending Upon The Category

when the category is selected, subcategory is showing the values depending upon the category, but when we click on the submit button , on wrong validation it is showing the fields which are incorrect or not filled. but at that time the subcategory values are not showing while the category is already selected.

problem is in yii framework we will be using ajax and not jquery.

as it is ajax, is it possible to load the subcategories also when refresh of the page?