How to populate state dropdown based on option selected in country dropdown by Ajax

Populating the state or city dropdown based on the value of option selected by the user in the country dropdown [Ajax]
My studio is not working can anyone suggest me these topic in code level.or give me some hits so that i can do it
Thank you