I have a simple application, in which I allow users to create posts. In order to create a post, users need to select a category. I want to use a collection select to show the category. When a user selects a category, I need to show another collection select below it, which lists the sub categories within that category. All this happens in the posts/new page.
I tried to implement this using jQuery and AJAX, I only got to the point when I could find the id of the category from the first collection select, confirmed by showing an alert() box showing that id. But I have no idea how to make an AJAX POST to the server with that id, retrieve the subcategories, and then show the second collection select.
All the examples I have found in the web did not work for me. Can anyone provide me with a complete working code that can serve for my requirement? Thanks.