Hola estoy intentando enviar un post vía ajax , pero me esta llegando request de tipo get vació. Estoy en una instalación limpia de laravel 5.4 (para probar que nada este interfiriendo de algún modo). este es mi código :
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link href="{{ asset('/css/dropzone.css') }}" rel="stylesheet">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="{!! asset('/js/dropzone.js')!!}"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="panel panel-primary">
<div class="panel-heading">
Dropzoneeeee
</div>
<div class="panel-body">
<form action="{{ route('image.store') }}" class="dropzone" id="dropzone" method="POST">
<input type="hidden" name="_token" value="{{{ csrf_token() }}}">
</form>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
Dropzone.options.myAwesomeDropzone = {
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 2,
method:"POST",
accept: function(file, done) {
if (file.name == "justinbieber.jpg") {
done("Naha, you don't.");
}
else { done(); }
}
};
</script>
las rutas en web.php:
<?php
Route::get('/', function () {
return view('welcome');
});
Route::post('/image', ['as' => 'image.store', 'uses' =>
ImageController@store']);
el controlador
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ImageController extends Controller
{
public function store(Request $request){
dd($request);
}
}