mercredi 7 mars 2018

How to use $_GET variable from AJAX - LARAVEL

I need to use the $_GET variable into the blade. The AJAX code work good, i received an alert with the correct value but i can't use it into the blade.

Route:

/*
|--------------------------------------------------------------------------
| Routes per gestire la pagina "Home"
|--------------------------------------------------------------------------
*/
Route::get('/home', 'HomeController@index');
Route::get('/home', array('as' => 'success', 'uses' => 'StatisticheController@totaleRichiesteAnnue'));

home.blade.php

@if(isset($_GET['tipologia_evento_id']))
   <div class="form-group">
   {!! Form::label('responsabile', 'Responsabile') !!}
   {!! Form::text('responsabile', old('_responsabile'), ['class' => 'form-control','disabled'=>'disabled']) !!}
   </div>
@endif
<script>
            var tipologia_evento_id = event.tipologia_evento_id;
            $.ajax({
                type: "GET",
                url: '/home',
                data: { tipologia_evento_id: tipologia_evento_id},
                success: function(msg)
                {
                    alert(tipologia_evento_id);
                    $('#modal-event').modal('show');
                }
            });
</script>



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

Aucun commentaire:

Enregistrer un commentaire