jeudi 30 juin 2016

How to pass an array from laravel to ajax

I have an array of fonts which i displaying in the page using blade templates @foreach like this

       @foreach($data as $fonts)
            <li class="abc">

                <div class="am-actions"><a href="" class="add-font"><span><i class="icon add"></i></span></a></div>
                 <a href="#" class="details">Grumpy wizards make toxic brew for the evil Queen and Jack.</a>
                </div>
                <div class="am-font-details">
                    <div class="am-font-name">{!! $fonts['font_name'] !!}</div> 
                    <div><?php echo $count = count($fonts['variants']); ?> Styles</div>
                </div>
                <div class="am-font-options">
                    <h4>SELECT VARIANTS TO INCLUDE:</h4>
                    <ul>
                        @foreach($fonts['variants'] as $variants)

                          <li><label><input type="checkbox">

                          


                          </label></li>

                        @endforeach

                    </ul>
                    <h4>LANGUAGE/SCRIPT TO INCLUDE:</h4>
                    <ul>
                        @foreach($fonts['subsets'] as $subsets)

                         <li><label><input type="checkbox"> </label></li>

                        @endforeach
                    </ul>
                </div>
            </li>
        @endforeach

as you can see i use @foreach for variants and languages inside the main loop the variants and langauges is listed with checkbox so the user can selected their choice and add. on the add the selected variants and languages with the main font array details should be passed through ajax please help me :-(




Aucun commentaire:

Enregistrer un commentaire