dimanche 24 janvier 2016

pass value of foreach using ajax (Laravel 5)

My Laravel View Code is like this :

<div>
...
@foreach($hotel as $key=>$value)
...
{{ $key }}
{{ $value['HotelNo'] }}      
{{ $value['HotelName'] }}
...     
<button id="save">More</button>
</div>
<div id="loading"></div>    
...            
@endforeach
...

My Javascript Code is like this :

<script type="text/javascript">
    $('#save').click(function () {
        $('#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 pass all value of $hotel to hotel-detail using ajax

But, I had trouble. Because there are a lot of values that I send

How do I send all the value of $hotel to hotel-datail using ajax?

Any suggestion to solve my problem?

Thank you very much



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

Aucun commentaire:

Enregistrer un commentaire