Hello,
For some reason or another I don't seem to be able to access the Posted data in my Controller. If I append FormData with with the input values, e.g.
formData.append('fName', $('#fName').val());
I can then access
Input::get('fName');
But I don't believe this should be necessary? As I've seen lots of examples that don't seem to do this.. So I'm guessing I'm missing something here?
Routes - https://github.com/colouredFunk/LaravelTest/blob/master/routes.php
View - https://github.com/colouredFunk/LaravelTest/blob/master/create.blade.php
Controller - https://github.com/colouredFunk/LaravelTest/blob/master/AccountController.php
Thanks for you help in advance, I'm new to Laravel, but loving it so far! Although I do seem to have a lot of questions :)
your Formdata
must be an <input>
tag, and have a name="fName"
Thanks for your reply, but I'm not 100% I'm following you.
This is the code for my form
<form action="#" method="POST" id="reportForm"> <input type="hidden" class="form-control" name="id" id="id"> <input type="text" class="form-control" name="fName" id="fName"> <input type="text" class="form-control" name="status" id="status"> <button type="submit" class="btn btn-lg btn-success "><span class="glyphicon glyphicon-floppy-disk"></span> Save</button> </form>Are saying I need to add an addition input type in there?
There’s a lot going on here so it’s hard to follow – I’d try breaking it down bit by bit until it works. Few observations...
processData: false
set in the AJAX request, is this effecting the data?FormData()
is or how it works, so that could be doing something unexpected?$report -> heading = Input::get('fName');
which I’m not sure will work as it shouldn’t have spaces when chaining, so it should be $report->heading
, so it’s possible that your page is just getting a 500 and not returning anything.Hope that gets you started.
Amazing thanks for pointing me in the right direction. I followed instructions from here (http://hayageek.com/jquery-ajax-form-submit/) and it seems to be working great now :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community