create form with Activeform depending on selected value of dropdown list

I have a dropdownlist that listing the category’s name from a table in database, for example books table or projects table.

each category has a special form for storing it to database and naturally each has different fields, for example books have one or more field more than projects.

so i need to get the selected value from the dropdown and create it corresponding form with ajax.