I want pass data from View to Controller along with one variable indicating what I need to perform on controller
Here is code for view function addUpdateData(data)
{
alert(data);
$(function(){
$.ajax({
method : "POST",
url: "welcome/addupdate",
data: {id: data},
success : function(response)
{
alert(response);
}
});
});
}
<input type="submit" id="add" class="btn btn-primary" onclick="addUpdateData(id)" value="Add"></button>
Below is code for routes.php
Route::post('welcome/addupdate','FormController@addUpdateData');
Below is code for controller
public function addUpdateData(Request $req)
{
$id = $req['data'];
return $id;
}
I want to receive posted data on controller with data variable where I will get whether I will add or update data..
I am getting error of Method Not Allowed I don't know what I am Missing!!!
please help
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1rNshwi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire