Ajax drop down menu

Hello guys,

I am trying to make an ajax drop down menu which takes 4 categories of cooking materials and when one category is clicked ,display the corresponding materials of that specific category.
After that by clicking add the material to the receipt and store in DB
Please I need guidance!
Any opinion is much appreciated!

You will need to use Pjax.

https://www.yiiframework.com/doc/api/2.0/yii-widgets-pjax

$parentList = getParentList();

$form posts the parent;

$child = getChildList($_GET[‘parent’]) ?? ‘’;