twitter bootstrap - Validate Boostrap modal contact form using Laravel 5, AJAX -


having trouble figuring out how use bootstrap modal in laravel 5 send contact form.

i want use ajax page doesn't refresh.

when click send in modal, 500 (internal server error) in console log.

what should ajax call like? should route like? need in controller simple response back?

having difficult time finding examples of these things.

here ajax...

$.ajax({   method: "post",   url: "/results-guest-card",   data: str,   datatype: "json",   success: function(result) {     if (response.status == "ok") {       console.log ('success');//success!       $('#guestcardmodal').modal('hide');       $('.modal-send-button').attr("disabled", false);     } else {       console.log ('failure');//fail!       $(".errors").html(result.errors);       $('.modal-send-button').attr("disabled", false);     }   } }); 

i writing answer might in future.

as op said 1 because of token.

it should fixed having csrf_token in forms.

how can have ?

just have csrf token in form having csrf_token hidden

like this

<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"> 

you can override bad few want it

you can remove csrf token

by commenting following in kernal.php won't recommend it.

'app\http\middleware\verifycsrftoken', 

hope helps


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -