Laravel Dynamic Dependent Dropdown using Ajax
HTML-код
- Опубликовано: 28 сен 2024
- 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....
i'm quite annoyed by the voice. but great stuff, thanks..
I want to change dropdown list colour scheme to blue to green. Is any way? can you please guide me?
Thanks for your time and efforts it helped me a lot
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
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.
Hi sir, Please make more video on laravel and ajax CRUD with full form elements includes input type file
Thanks Weblesson for sharing knowledge
pdate config/database.php
set:
'mysql' => [
'strict' => false,
],
instead of:
'mysql' => [
'strict' => true,
],
after doing this, the error will disappeared
thx, it's very help me! cool code!
thanks for that code 😁 but the voice irritates more more 😪its not clear ...
once again thanks for code
Please make more video on laravel and ajax
source code can't download
please repair link
Awesome video, thanks for the lesson!
good! But all in one table...
Thank you very much sir
Make video on laravel ajax filter using checkbox and start rating .
Laravel ajax comment system
Thanks team weblesson
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;
}
Obrigado!!
great stuff
next try to put with a original voice ..
Why that voice ?
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..
how to use two tables using same method (dependent dropdown) country in one table and state in another table
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 ?
I follow this code but it cannot show data on dropdown dependent,any one help?
This code work well on single value , but not working on multiple select value plz guide me
i hate the voice but great job
Nothing happened 🤤😢😥😭
Best tutorial
what if we want to select multiple country then show their state together
mali ang froeach
Hello Sir, Nice Video. lease Insert All These Dropdown Values In database Using Laravel . Make A Video Otherwise Add This With register Page.
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
is there any tutorial for getting selected dropdown value from the database using ajax in edit functionality?
hiiiiiiii
sometimes you just need the concept ... I made that with Vue js. Thanks
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
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
i like this
I wasted my time on something that doesn't work -.-
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 ????
please make more tutorial we will be pleased
I wanna see in vue.js. Nice. Tanks
wow what a great job.thank you very much
very nice
mantab slurrrr
thanks Webslesson, this help me alot.
you are the web boss
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
it's very very very help me! I love you !
did this work for you ???
How to submit this data from select boxes into new table of database??
ruclips.net/video/yIs_Y5adAYU/видео.html
Watch this.
You forgot to make ajax more secure in controller's action
if($request->ajax()){ //ajax code }
Great stuff my friend, thank you.