When I want use Ajax to update article in console I got: "Failed to load resource: the server responded with a status of 405 (Method Not Allowed)"
my jQuery code:
setInterval(function()
{
tinyMCE.triggerSave();
var url = window.location.href;
var article_id = /id\.([\d]+)/.exec(url)[1];
$.ajax(
{
url: '//' + $(location).attr('host') + '/cms/article/addDraft/' + article_id,
type: 'POST',
data: new FormData($('form.formAjax')[0]),
processData: false,
contentType: false,
success: function(response)
{
var alert = 'alert alert-warning';
$('.alert-box')
.hide()
.addClass(alert)
.html(response)
.slideDown(1500);
setTimeout(function() { $('.alert-box').slideUp(1500) }, 600);
}
});
},
6000);
and php:
// ADD ARTICLE DRAFT
public function addDraft($article_id)
{
Articles::where('id', '=', $article_id)->update(['title' => Request::Input('title'),
'description' => Request::Input('description')]);
return response(trans('errors.positive'), 200);
}
Thanks for help :)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire