简体   繁体   中英

Log file id not created for error in Laravel

I have a simple form in my Laravel site for asking questions.

While I have submitted the form using Ajax I have got error in my console like below

GET http://localhost/sencare_v2/ask-question-form-submit?first_name=shbshb&last_name=bhbh&email=hbhbh%40gmail.com&contact=5454&question=hbdndjnkdnjdnkdj&_token=aMg6TGCXdHYpjQ2qZP4RxhEIuTmKUHih6seg5kdm 404 (Not Found)

For getting the details of that error I have visited in my log file in storage/logs ...

But no file created regarding this error issue.

html form

<form id="ask_question_form" class="rd-mailform text-left" data-form-output="form-output-global" data-form-type="contact" action="" novalidate="novalidate">
    <input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" />
    <div class="range range-xs-center">
        <div class="cell-sm-6">
            <div class="form-group form-group-label-outside">
                <input class="form-control form-control-last-child" id="ask_question_first_name" type="text" name="first-name" data-constraints="@Required" placeholder="First Name"><span class="form-validation"></span>
            </div>
            <div class="form-group form-group-label-outside offset-top-20">
                <input class="form-control form-control-last-child" id="ask_question_email" type="email" name="email" data-constraints="@Email @Required" placeholder="Email"><span class="form-validation"></span>
            </div>
        </div>
        <div class="cell-sm-6 offset-top-20 offset-sm-top-0">
            <div class="form-group form-group-label-outside">
                <input class="form-control form-control-last-child" id="ask_question_last_name" type="text" name="last-name" data-constraints="@Required" placeholder="Last Name"><span class="form-validation"></span>
            </div>
            <div class="form-group form-group-label-outside offset-top-20">
                <input class="form-control form-control-last-child" id="ask_question_contact_no" type="text" name="last-name" data-constraints="@IsNumeric @Required" placeholder="Contact No"><span class="form-validation"></span>
            </div>
        </div>
    </div>
    <div class="form-group form-group-label-outside padding-top-20">
        <textarea class="form-control form-control-last-child" id="ask_question_message" name="message" data-constraints="@Required" style="max-height: 150px;" placeholder="Question"></textarea><span class="form-validation"></span>
    </div>
    <div class="offset-top-18 offset-sm-top-30 text-center text-sm-left">
        <button id="ask_question_submit_button" class="btn btn-ellipse btn-primary" type="button" style="min-width: 130px;">send message</button>
    </div>
</form>

ajax part

$.get('ask-question-form-submit', {'first_name': ask_question_first_name, 'last_name': ask_question_last_name, 'email': ask_question_email, 'contact': ask_question_contact_no, 'question': ask_question_message, '_token':$('input[name=_token]').val()}, function(data)
    {}

web.php inside routes/

Route::get('/ask-question-form-submit/{data}', 'homeController@ask_question_form');

How to solve this? Anybody help please ?

Thanks in advance

Regarding the log issue. It's not there because nothing in Laravel broke down. This is simply js telling you that it didn't find the route you gave it. Wouldn't it be better to submit your form with post request. You would have to change ajax to post and also your route type. Remove the /{data} part and see if it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM