I'm a newbie in laravel I want to add a product using ajax method but I'm getting this error, in the console, I'm getting POST 404 NOT FOUND and in the network, I'm getting this error message
{message: "", exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…}
here is my ajax code I can't find the error
<script>
$(document).ready(function(){
// alert("working");
$("#btn").click(function(){
var prodName = $("#prodName").val();
var rate = $("#rate").val();
var beginningQuantity = $("#beginningQuantity").val();
var token = $("#token").val();
$.ajax({
type: "POST",
data: "prodName=" + prodName + "&rate=" + rate + "&beginningQuantity=" + beginningQuantity + "&_token" + token,
url: "<?php echo url('/saveProduct') ?>",
succes:function(data){
console.log(data);
}
});
});
});
</script>
here's the controller codes
public function saveProduct(){
return $request;
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire