How to add multiple product without refreshing page in laravel Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to add multiple product without refreshing page in laravel without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am creating campaign.
In that campaign i want to add multiple products without refreshing page and store the detail of that products in database.

enter image description here

ProductCatalogController :

public function storeProduct(Request $request)
    {

        $this->validate($request, $this->rules);

        $input=Input::all();
        var_dump($input);
        exit();
        $campaign_product=ProductCatalog::create($input);
        return redirect('product_catalog');
    }

Answer

you can add ajax like this

var myKeyVals = { A1984 : 1, A9873 : 5, A1674 : 2, A8724 : 1, A3574 : 3, A1165 : 5 }

var saveData = $.ajax({
      type: 'POST',
      url: "urlToMethod",
      data: myKeyVals,
      success: function(resultData){
         alert("Save Complete") }
    });
We are here to answer your question about How to add multiple product without refreshing page in laravel - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji