This question already has an answer here:
Below is the code in Blade.
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
@foreach($Projects as $Project)
<tr>
<td>
@if($Project->ProjectStatusID == \App\Enumeration\Project\ProjectStatus::Open)
<a pid="{!! $Project->ProjectID !!}" class="Shutmedown" >Cancel</a>
@endif
</td>
</tr>
@endforeach
JQuery
$('.Shutmedown').click(function() {
$.ajax({
url: "/CancelProject",
type: "POST",
data: {"ProjectID" : $(this).attr('pid')},
async: true,
contentType: "application/json; charset=utf-8",
success: function () {
location.reload();
},
error: function () {
alert('hi');
}
});
});
What's the Problem ?
JQuery Ajax gives error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
On checking more details about the request: I got below error details.
TokenMismatchException in VerifyCsrfToken.php line 53:
Am I missing something ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire