How to Post and insert Data into DB using Laravel, Bootstrap Modal and Ajax

Issue is i am not able to get bootstrap modal textarea input value using Input::get(), it returns null.

Modal’s submit and text input(my view):

<button type="button" class="btn btn-danger" onclick="customModalSubmitFunction('modalID')">Submit</button>

JS function:

function customModalSubmitFunction(modalID){
        type: "POST",
        url: "urlRouteToController"

Route.php route

Route::post('urlRouteToController', array(
    'uses' => 'myController@insertValueIntoDatabase',
    'as' => 'urlRouteToController'


public function myController(){
   $dbModel = new Model;
   $dbModel->column1 = Input::get('textbox1');

In conclusion, i cannot get posted data using Input::get(‘textbox1’). But inserting data into database as null values (because i cannot get textbox value) part works.

Thanks in advance.

Source: laravel

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.