Laravel Dynamic Dependent Dropdown using Ajax
HTML-код
- Опубликовано: 19 мар 2018
- Learn How to Make Dynamic Dependent in Laravel using Ajax. How to use Laravel with Ajax for populate dropdown listbox with dynamic data. How to Create Dynamic Dropdown in Laravel. Dynamic Dependent Dropdown in Laravel using jQuery and Ajax.
Source Code - www.webslesson.info/2018/03/aj...
Thanks Weblesson for sharing knowledge
Awesome video, thanks for the lesson!
Great stuff my friend, thank you.
thanks Webslesson, this help me alot.
Thanks for your time and efforts it helped me a lot
wow what a great job.thank you very much
thx, it's very help me! cool code!
i'm quite annoyed by the voice. but great stuff, thanks..
sir, just follow up question.. is this the best way to approach dynamic dependent dropdown? specially on country state city situation? how bout the relationship type like each has its own table.. table country, table state, table city and connect them using relationships.. please i need ur opinion on this since im a newbie..
Hi, thanks for sharing this video, I want to see if you can help me, I have only two dropdowns for state and city. The values of the city dropdown are loaded correctly, but if there is some validation that is not fulfilled in the form, for example a field not captured, the city dropdown loses the elements that had been previously loaded.
Thank you in advance if you could guide me
Thank you very much sir
Thanks team weblesson
thanks for the tutorial, please state data and city is not loading when the country option is selected from my end, it just remain blank, any help ?
Hi sir, Please make more video on laravel and ajax CRUD with full form elements includes input type file
Best tutorial
how to use two tables using same method (dependent dropdown) country in one table and state in another table
Please make more video on laravel and ajax
you are the web boss
Obrigado!!
it's very very very help me! I love you !
did this work for you ???
is there any tutorial for getting selected dropdown value from the database using ajax in edit functionality?
what if we want to select multiple country then show their state together
great stuff
This video is awesome..
Can you please tell me what is the use of _token variable in this video
This is for protection. This prevent the CSRF attack
This video is very good for one db table. But, if db table are multiple, then what can I do. Please reply me with a good suggestions.
Best Regards
just use country id to query in state and state id to query in city table everything is same
I wanna see in vue.js. Nice. Tanks
I want to change dropdown list colour scheme to blue to green. Is any way? can you please guide me?
This code work well on single value , but not working on multiple select value plz guide me
please make more tutorial we will be pleased
sometimes you just need the concept ... I made that with Vue js. Thanks
very nice
i like this
thanks for that code 😁 but the voice irritates more more 😪its not clear ...
once again thanks for code
I follow this code but it cannot show data on dropdown dependent,any one help?
Make video on laravel ajax filter using checkbox and start rating .
Laravel ajax comment system
Hello Sir, Nice Video. lease Insert All These Dropdown Values In database Using Laravel . Make A Video Otherwise Add This With register Page.
Sir please make Dependent Drop Down in laravel 8 using Ajax and jQuery.........Love From India UP
good! But all in one table...
thanks
How to submit this data from select boxes into new table of database??
ruclips.net/video/yIs_Y5adAYU/видео.html
Watch this.
mantab slurrrr
groupby clause on Oracle having issues ORA-00979: not a GROUP BY expression.Did anyone have the same issue.Any help is much appreciated.
hey there , I am having the same problem have you fixed yours ????
pdate config/database.php
set:
'mysql' => [
'strict' => false,
],
instead of:
'mysql' => [
'strict' => true,
],
after doing this, the error will disappeared
Hi Thanks for the tut. But for some reason, I can get it work. I'm getting error in the console: POST 127.0.0.1:8000/dynamic_dependent/fetch 500 (Internal Server Error) jquery.min.js:4. Any idea? I tried multiple projects with different machines with same result. I'm using WAMP Server.
have exactly the same issue. exept for: jquery.min.js:2
Did You solve this?
public function dynamicDropdown() {
$countrylist = DB::table('dynamicdropdown')->select('Country')->groupBy('Country')->get();
return view('dynamicdropdown')->with('countrylist', $countrylist);
}
function fetch(Request $request)
{
$select = $request->get('select');
$value = $request->get('value');
$dependent = $request->get('dependent');
$data = DB::table('dynamicdropdown')
->where($select, $value)
->select($dependent)
->groupBy($dependent)
->get();
$output = 'Select '.ucfirst($dependent).'';
foreach($data as $row)
{
$output .= ''.$row->$dependent.'';
}
echo $output;
}
Change like this and it will work, you have to use select method, i was getting this error today and fixed and killed my 2 hrs.
@@mysteriousmsn You are a life saver thanks so much
@@tinkerbell6834 You are Welcome.
Hello groupBy('country') method is throwing this error "SQLSTATE[42000]: Syntax error or access violation: 1055 'testing.country_state_city.id' isn't in GROUP BY (SQL: select * from `country_state_city` group by `country`)" Any idea?
yes
source code can't download
please repair link
this source code link can't work can you help me pls
Arman i think the source code is correct check that
1. He didn't create controller as usual but it is only DynamicDependent.php
2. Be sure you write correctly in web.php Don't forget first one is GET method and second one is POST
the database structure isn't good not normalize and can cause a problem for the future use
WHOEVER IS GETTING SERVER ERROR TRY TO IMPLEMENT LIKE BELOW, ALL YOU HAVE TO DO IS TO USE "SELECT" METHOD IN THE QUERY BUILDER FUNCTIONS
public function dynamicDropdown() {
$countrylist = DB::table('dynamicdropdown')->select('Country')->groupBy('Country')->get();
return view('dynamicdropdown')->with('countrylist', $countrylist);
}
function fetch(Request $request)
{
$select = $request->get('select');
$value = $request->get('value');
$dependent = $request->get('dependent');
$data = DB::table('dynamicdropdown')
->where($select, $value)
->select($dependent)
->groupBy($dependent)
->get();
$output = 'Select '.ucfirst($dependent).'';
foreach($data as $row)
{
$output .= ''.$row->$dependent.'';
}
echo $output;
}
next try to put with a original voice ..
Why that voice ?
Nothing happened 🤤😢😥😭
hiiiiiiii
You forgot to make ajax more secure in controller's action
if($request->ajax()){ //ajax code }
mali ang froeach
i hate the voice but great job
I wasted my time on something that doesn't work -.-