I have an ajax call that has a generated url via a paginator script:
"http://ift.tt/1FOpXIW"
Quite the same link is generated on the server:
"http://ift.tt/1PntWwW
The links are passed to this ajax call, in this case set as data:
$.ajax({
url: (data) ? data : '/pricing/' + this.state.country + '/' + this.state.operation + '/' + this.state.optional,
type: 'POST',
data: {
_token: window.token
},
success: function (e) {
$('#loader-wrapper').fadeOut();
this.setState({
paginator: true,
menuActive: false
});
this.handleArticles(e);
}.bind(this),
error: function (err) { alert(err);
console.log(err);
}
})
On localhost the next page is loaded without any problems, but on the server I get an error 405 - Method Not Allowed.
I'm using a combination of react.js and laravel. My route for this kind of link is:
post('pricing/{country}/{operation}/{page}', 'PricingController@getArticles');
I only know method not allowed errors from a get request to a post route, but that's not the case as ajax is performing a post call though there is some "get data" attached, and more important, it's working on localhost. Does somebody have an explanation for this and how could I solve it?
Aucun commentaire:
Enregistrer un commentaire