我正在尝试将jquery ajax合并到我的项目中,当我尝试删除记录时,我获得了500(内部服务器错误)。
我的代码
<a href="javascript:checkDelete({{$model->id}});">Delete Model </a>
JS
<script>
function checkDelete(id) {
if (confirm('Really want to delete?')) {
$.ajax({
type: "DELETE",
url: '/admin/models/' + id,
success: function(result) {
//
}
});
}
}
</script>
我的路线:
Route::group(array('before' => 'auth'), function() {
Route::resource('admin/users', 'UsersController');
Route::resource('admin/posts', 'PostsController');
Route::resource('admin/models', 'ModelsController');
Route::resource('admin/models.pictures', 'PicturesController');
Route::resource('admin/models.videos', 'VideosController');
Route::get('dashboard', 'DashboardController@index');
Route::get('admin/ayuda', function() {
return View::make('admin.ayuda');
});
});
答案 0 :(得分:-3)
$.ajax({
type: "GET",
url: '/admin/models/' + id,
success: function(result) {
//
}
});