Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  78] [ 2]  / answers: 1 / hits: 21226  / 11 Years ago, sat, september 21, 2013, 12:00:00

on Firefox, only on firefox it will popup and give you a warning This web page is being redirected to a new location. Would you like to resend the for form you have typed to the new location.



I got no form , i use javascript to extract values from textbox



I checked on firebug it says
PUT /admin/submit-scan/ 301 moved permanently
PUT submit-scan 302 Found



My JS



function submitGoods(){
var registeredNo = $('input[name=registeredno]').val();
var weight = $('input[name=weight]').val();
$.ajax({
type: 'PUT',
url: '/admin/submit-scan/',
data: {
registeredNo: registeredNo,
weight: weight,
_token: csrfToken
},
dataType: 'json'
}).done(function(data){

data = $.parseJSON(data);
});

}


My Route



Route::put('submit-scan', 'ControllersAdminDashboardController@putUpdateSubmitScan');


My controller



 public function putUpdateSubmitScan()
{
if (Request::ajax())
{
return Response::json(array('success' => 1, 'data' => test));
}
}


Any idea what went wrong?


More From » php

 Answers
42

Removing the trailing slash should do the trick (most probably prior to Laravel 4.1, see below).



url: '/admin/submit-scan'


Update



As mentioned in Laravel4 POST unexplained redirect to GET



Laravel bootstrap/start.php is calling $app->redirectIfTrailingSlash(); which seems to be the culprit. This has been changed in Laravel 4.1:



http://laravel.com/docs/upgrade#upgrade-4.1


[#75539] Friday, September 20, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
averyc

Total Points: 102
Total Questions: 113
Total Answers: 89

Location: Taiwan
Member since Mon, Sep 6, 2021
3 Years ago
;