Need javascript help

Job ID: 38752943

Budget: ₹600 – ₹1,500 INR

I have 2 form field.

- Category
- Sub Categories

There are 2 fixed categories, and subcategories are attached to them.

When a user selects a category, I want to run a database query and show the values of the sub-categories field based on the category selected earlier. Without reloading the page.