lundi 25 janvier 2016

How to get the value of each iteration?

My Laravel View is like this :

    ...
        @foreach($hotel as $key=>$value)    
    ...
           <input type='hidden' value='<?php  echo $value['HCode'].'#'.$value['HName'].'#'.$value['CheckIn'].'#'.$value['CheckOut']   ?>' id='tes'>
    ...
    ...
           {{ $value['HotelNo'] }}      
           {{ $value['HotelName'] }}
    ...     
           <button id="save">More</button>

           <div id="loading"></div>    
    ... 
        @endforeach
    ...

My Javascript is like this :

<script type="text/javascript">
    $('#save').click(function () {
        var bla = $('#tes').val();
        console.log(bla);
        $('#loading').html('<img src="http://ift.tt/1PwvLqC"> loading...');

        $.ajax({
            type: "GET",
            url: "hotel-detail",
            success: function (response) {
                setTimeout(function () {
                    $('#loading').html('...');
                }, 2000);
            }
        });  
    });
</script>     

I want get value of each iteration. So, when I click "more" button, I get value of id tes.

How to get the value of each iteration?

Any solution to solve my problem?

Thank you very much



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1VjRp5V
via IFTTT

Aucun commentaire:

Enregistrer un commentaire