samedi 5 mars 2016

Laravel 5.2 ajax returns 500 Internal Server Error

My question has been asked and answered here : ajax post in laravel 5 return error 500 (Internal Server Error)
But the problem still exists for me.

//master.blade.php
<!DOCTYPE html>
<html>
<head>
...
<meta name="csrf-token" content="{{ csrf_token() }}">
...
</head>

and create inherits admin that inherits master

//create.blade.php
@extends('admin')

@section('head_scripts')
<script>
    $(function(){
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $('#country_id').change(function(){
            $('#province_id').find('option').remove().end();
            $('#province_id').attr('disabled', true);
            $('#city_id').find('option').remove().end();
            $('#city_id').attr('disabled', true);
            var cid=$(this).val();
            var params={"type":1, "country_id":cid};
            var paramsString=JSON.stringify(params);
            console.log(paramsString);
            $.ajax({
                url:'/company/ajax',
                type:'POST',
                data:{json: paramsString},
                dataType:'json',
                success:function(result){
                    console.log(result);
                    $('#provinceSelectContainer').html(result);
                }
            });
        });
    });

Any idea?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TyQrWS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire