i want to insert data from register form by ajax.
but I see ajax failed
in my console log.
I can't understand what is problem ?
here is my js :
$('#Personal_Information').on('submit', function(event){
event.preventDefault();
var form_data = $(this).serialize();
$.ajax
({
type: "POST",
dataType : 'json',
url: "",
data: {csrf_token:"", data: form_data}
}).done( function(data){
console.log('Ajax was Successful!')
console.log(data)
}).fail(function(){
console.log('Ajax Failed')
});
here is my route :
Route::get('/update-profile', 'personalinformation@redirectupdatepage')->name('/all.update-profile');
Route::post('/all/update-profile', 'personalinformation@store');
my controller's code :
public function store(Request $request)
{
$modal = User::create($request->all());
return $modal;
}
Thanks.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2s5rLvC
via IFTTT
Aucun commentaire:
Enregistrer un commentaire