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....

Комментарии • 77

  • @bigcato5840
    @bigcato5840 5 лет назад +22

    i'm quite annoyed by the voice. but great stuff, thanks..

  • @smartowlgraphics4374
    @smartowlgraphics4374 3 года назад

    I want to change dropdown list colour scheme to blue to green. Is any way? can you please guide me?

  • @tinkerbell6834
    @tinkerbell6834 3 года назад

    Thanks for your time and efforts it helped me a lot

  • @rahim3070
    @rahim3070 6 лет назад +1

    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

    • @braintricker_soft
      @braintricker_soft 4 года назад +1

      just use country id to query in state and state id to query in city table everything is same

  • @livresonltc9754
    @livresonltc9754 5 лет назад +1

    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.

    • @trapkick5570
      @trapkick5570 4 года назад +1

      have exactly the same issue. exept for: jquery.min.js:2
      Did You solve this?

    • @mysteriousmsn
      @mysteriousmsn 3 года назад +1

      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.

    • @tinkerbell6834
      @tinkerbell6834 3 года назад +1

      @@mysteriousmsn You are a life saver thanks so much

    • @mysteriousmsn
      @mysteriousmsn 3 года назад +1

      @@tinkerbell6834 You are Welcome.

  • @nandalals9441
    @nandalals9441 6 лет назад +1

    Hi sir, Please make more video on laravel and ajax CRUD with full form elements includes input type file

  • @jhanhm
    @jhanhm 6 лет назад

    Thanks Weblesson for sharing knowledge

  • @belongersgaming8046
    @belongersgaming8046 3 года назад

    pdate config/database.php
    set:
    'mysql' => [
    'strict' => false,
    ],
    instead of:
    'mysql' => [
    'strict' => true,
    ],
    after doing this, the error will disappeared

  • @uristmsk
    @uristmsk 5 лет назад +2

    thx, it's very help me! cool code!

  • @rahulkrishna7810
    @rahulkrishna7810 2 года назад

    thanks for that code 😁 but the voice irritates more more 😪its not clear ...
    once again thanks for code

  • @nabeeltahir6013
    @nabeeltahir6013 6 лет назад +1

    Please make more video on laravel and ajax

  • @bennyuntung3706
    @bennyuntung3706 4 года назад

    source code can't download
    please repair link

  • @SuperMakoto13
    @SuperMakoto13 6 лет назад

    Awesome video, thanks for the lesson!

  • @samoilenko_roman
    @samoilenko_roman 5 лет назад +2

    good! But all in one table...

  • @nabeeltahir6013
    @nabeeltahir6013 6 лет назад

    Thank you very much sir

  • @nabeeltahir6013
    @nabeeltahir6013 6 лет назад

    Make video on laravel ajax filter using checkbox and start rating .
    Laravel ajax comment system

  • @bushramustofa2135
    @bushramustofa2135 5 лет назад

    Thanks team weblesson

  • @seekeralert9267
    @seekeralert9267 4 года назад

    the database structure isn't good not normalize and can cause a problem for the future use

  • @mysteriousmsn
    @mysteriousmsn 3 года назад

    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;
    }

  • @osvaldobanze1845
    @osvaldobanze1845 5 лет назад +1

    Obrigado!!

  • @sangeeth810
    @sangeeth810 4 года назад

    great stuff

  • @rahulkrishna7810
    @rahulkrishna7810 2 года назад +1

    next try to put with a original voice ..

  • @LOMBOist
    @LOMBOist 5 лет назад +1

    Why that voice ?

  • @mdnazimuddin5211
    @mdnazimuddin5211 6 лет назад

    thanks

  • @maliqnorman5539
    @maliqnorman5539 5 лет назад +6

    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..

  • @sarandatech4322
    @sarandatech4322 4 года назад +2

    how to use two tables using same method (dependent dropdown) country in one table and state in another table

  • @olayemiolaribigbe3333
    @olayemiolaribigbe3333 4 года назад +1

    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 ?

  • @ferdyhananto6279
    @ferdyhananto6279 3 года назад +1

    I follow this code but it cannot show data on dropdown dependent,any one help?

  • @m.abubakarkhan4451
    @m.abubakarkhan4451 Год назад

    This code work well on single value , but not working on multiple select value plz guide me

  • @farahzainodin7593
    @farahzainodin7593 4 года назад +1

    i hate the voice but great job

  • @jessierhanculubong6242
    @jessierhanculubong6242 4 года назад +1

    Nothing happened 🤤😢😥😭

  • @icrmsoftware59
    @icrmsoftware59 5 лет назад +1

    Best tutorial

  • @Kahanikiduniya5
    @Kahanikiduniya5 4 года назад

    what if we want to select multiple country then show their state together

  • @carlahdiesto2481
    @carlahdiesto2481 3 года назад

    mali ang froeach

  • @devenderkumar2761
    @devenderkumar2761 5 лет назад

    Hello Sir, Nice Video. lease Insert All These Dropdown Values In database Using Laravel . Make A Video Otherwise Add This With register Page.

  • @murleeyadav7800
    @murleeyadav7800 6 лет назад +1

    This video is awesome..
    Can you please tell me what is the use of _token variable in this video

    • @rogeriopicilli5545
      @rogeriopicilli5545 4 года назад +1

      This is for protection. This prevent the CSRF attack

  • @keyurvala2489
    @keyurvala2489 2 года назад

    is there any tutorial for getting selected dropdown value from the database using ajax in edit functionality?

  • @infiappsolution
    @infiappsolution 4 месяца назад

    hiiiiiiii

  • @aashiq_hasnat
    @aashiq_hasnat 3 года назад

    sometimes you just need the concept ... I made that with Vue js. Thanks

  • @luisfernandogonzaleztostad1294
    @luisfernandogonzaleztostad1294 4 года назад

    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?

  • @NanoRdz1976
    @NanoRdz1976 5 лет назад

    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

  • @cocoiron4475
    @cocoiron4475 4 года назад

    i like this

  • @IphoneUser27
    @IphoneUser27 3 года назад

    I wasted my time on something that doesn't work -.-

  • @spreddy23
    @spreddy23 6 лет назад

    groupby clause on Oracle having issues ORA-00979: not a GROUP BY expression.Did anyone have the same issue.Any help is much appreciated.

    • @djohnoliver
      @djohnoliver 5 лет назад

      hey there , I am having the same problem have you fixed yours ????

  • @MDFARUK-il8pw
    @MDFARUK-il8pw 6 лет назад

    please make more tutorial we will be pleased

  • @heyyy4987
    @heyyy4987 6 лет назад

    I wanna see in vue.js. Nice. Tanks

  • @kmsohelrana8246
    @kmsohelrana8246 5 лет назад

    wow what a great job.thank you very much

  • @237camerpreneur8
    @237camerpreneur8 5 лет назад

    very nice

  • @napchannel2703
    @napchannel2703 3 года назад

    mantab slurrrr

  • @khoadoo5505
    @khoadoo5505 5 лет назад

    thanks Webslesson, this help me alot.

  • @MDFARUK-il8pw
    @MDFARUK-il8pw 6 лет назад

    you are the web boss

  • @armanhossain9936
    @armanhossain9936 5 лет назад

    this source code link can't work can you help me pls

    • @bushramustofa2135
      @bushramustofa2135 5 лет назад

      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

  • @alinoori6931
    @alinoori6931 4 года назад

    it's very very very help me! I love you !

  • @ashwinishahapurkar7478
    @ashwinishahapurkar7478 6 лет назад

    How to submit this data from select boxes into new table of database??

    • @AliRazaiamaliraza
      @AliRazaiamaliraza 6 лет назад

      ruclips.net/video/yIs_Y5adAYU/видео.html
      Watch this.

  • @k3logics925
    @k3logics925 5 лет назад +1

    You forgot to make ajax more secure in controller's action

    • @k3logics925
      @k3logics925 5 лет назад +1

      if($request->ajax()){ //ajax code }

  • @infiappsolution
    @infiappsolution 4 месяца назад

  • @animanoir
    @animanoir 5 лет назад

    Great stuff my friend, thank you.