Skip to main content

Posts

Showing posts from January 22, 2023

How to use AJAX for fetching data in child dropdown by selecting Parent dropdown - Nodejs , Expressjs, MongoDB

 // so here i have dummy database to understand -  suppose we have Thee product categories electronic, Garments & home appliance , In which we have subcategories please refer below two pictures  1. Category (parent Dropdown ) // MongoDB database 2. Subcategory (child Dropdown )       now I want that if  I would  select product category, product subcategories should automatically fetched in in second or child dropdown   =====================//addProduct.ejs Start ================================= <form method="post" action="/admin/launchp" enctype="multipart/form-data"> <div class="form-group"> <label for="catnm" style="color: #870A30;">Product Category </label> <select class="form-control" id="category-dropdown" name="catnm"> <option value="">Product Category:</option> <% if(clist.length){ for(var i = 0; i< clist.length; i++) {%>  ...