mercredi 16 décembre 2015

Method Not Allowed while doing Ajax

Route

Route::put('{cpe_mac}/device/{device_mac}/rate/update',['as'=>'device.rate.update', 'uses'=>'DeviceController@updateRate']);


Ajax

$.ajax({
    url: '{{env("APP_URL")}}{{$cpe_mac}}'+'/device/'+'{{$device_mac}}'+'/rate/update',
    type: 'PUT',
    dataType: 'json',
    contentType: "application/json; charset=utf-8",
    data: $inputs ,
    success: function (data, textStatus, xhr) {

        console.log(data);
    },
    error: function (xhr, textStatus, errorThrown) {

        console.log('PUT error.', xhr, textStatus, errorThrown);
    }
});


Result

PUT http://localhost:8888/000D6766F2F6/device/080027E2FC7D 405 (Method Not Allowed)

I triple check my routes declaration, and the Ajax url, I'm not sure why my Ajax PUT cutting off the last 2 segments of my url.

Any hints ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire