Dependent / Cascading Dropdown for multiple ( model,table,controller)
I have two migration table in a database named "2018_09_26_152831_create_all_drivers_table" & "2018_09_26_141623_create_all_routes_table". There are different model ( "AllDriver.php" & "AllRoute.php") and controller ( "AllDriverController.php" & "AllRouteController.php" ) for these two different table.
There are also another migration table named "2018_09_26_144829_create_all_buses_table". for this table I also have similar model & controller too. In the "allbus.create" page I have two dropdown field named "Select Route" and "Select Driver". Here I want to get the Driver Name on behalf of selecting route no.
So can anyone please tell me the process, how can I build it successfully using Ajax or something else..?
@mousumi_mou - you are going to need to initially populate the routes dropdown from your backend. Then add an onChange event listener to the dropdown that sends an AJAX request to a URL route on your backend that accepts the route_id that was selected and returns the driver data for that specific route which then updates the driver dropdown.
Do you now how to use javascript? You're not asking a quick/easy question to answer. If you only need ajax, I'd look at axios. https://www.npmjs.com/package/axios
If this is overly complex, I'd turn it into a 2 step process and not use ajax.
Page one is a regular form that has the initial dropdown for the driver. They select a value in the dropdown and submit. Then use the value submitted to retrieve the route values for 2nd dropdown and populates a new form.