dimanche 19 avril 2020

Laravel & JS: Making a GET request with 2 variables

My Laravel controler has the following function:

function products($collectionName) {

    ////
}

In my routes file, it is:

Route::get('admin/toys/collections/products/{collectionName}', 'Admin\ToysController@products');

I've since added a 2nd optional param to products so that it is now:

function products($collectionName, $quantity=null) {

}

Blade file I am trying to make an AJAX request in the blade but I don't know how to pass in the fields since there are now 2 -- is this possible without making it into a POST request now?

  <?php $collectionName = "testing"; 
         $quantity = "55"
   ?>

    $.ajax({
       type:'get',
       url: 'admin/toys/collections/products/' + 
    )}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire