jeudi 26 mai 2016

How to get a value from ajax call in laravel

I want to get a value from the ajax call in controller function.how can i do it..!!

my code is here:

<a  href="javascript:void(0)" onclick="amount_pay('');"><i class="fa fa-pencil-square-o"></i></a>

my script:

<script>

function amount_pay(id) 
         { 
            $.ajax({
            type: 'POST',
            url:  'amount_popup/'+ id,// calling the file  with id

            success: function (data) {
                alert(1);
            }
        });
      } 
</script>

my route:

Route::post('amount_popup/{id}', 'AdminController\AmountController@amount_to_pay');

my controller function:

public function amount_to_pay($id)
    {   
        echo $id;
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire