dongxixia6399 2017-02-06 02:43
浏览 28

意外的令牌:,Ajax成功消息Laravel

I'm trying to Ajax success message in Ajax success method, but i got Unexpected token ( error on my console by using inspect element browser.

here's my Ajax code so far :

$(document).ready(function() {
        var rawDORecordsDataTable = $('#raw_do_record_table').DataTable(
        {
            dom: 'Blrtip',
            orderCellsTop: true,
            responsive: true,
            processing: true,
            serverSide: true,
            iDisplayLength: 50,
            ajax: {
                url:  '{{ route('raw_do_record.list') }}',
                data: function(data) {
                    data._token = '{{ csrf_token() }}';
                    data.do_date = $('#search_date').val();
                    data.do_status = 0;
                },
                type: 'POST',
            },
            columns: [
                { data: 'do_no', name: 'do_no' },
                { data: 'do_status', name: 'do_status' },
                { data: 'customer', name: 'customer' },
                { data: 'store_isn', name: 'store_isn' },
                { data: 'warehouse_status', name: 'warehouse_status' },
                { data: 'do_date', name: 'do_date' },
                { data: 'delivery_status', name: 'delivery_status' },
                { data: 'action', name: 'action', orderable: false, searchable: false },
            ] ,
            searchCols: [
                null , 
                { "search" : 0} ,
            ],
            buttons: [
                @if(Gate::allows('views',[[Department::LOGISTICS]]))
                { text: 'Generate All',
                    action: function ( e, dt, node, config ) {
                        $('#generate_all_modal').modal('show')
                    } 
                },
                @endif
                { text: '<i class="fa fa-refresh"></i> Refresh DO',
                    action: function ( e, dt, node, config ) {
                        $('#refresh_do_modal').modal('show')
                    } 
                }
            ],

        })
        .on('click', 'a.stop', function(e) {
            $.ajax({
                url: '{{ route('raw_do_record.list') }}',
                type: 'POST',
                data: { 
                    '_token' : '{{csrf_token() }}',
                },
                success: function(data) {
                    alert("asd");
                },
                error: function(data) {
                    alert("asdasd");
                }
                });
            });

and here's the modal html :

<div class="modal fade bs-modal-sm" id="stop_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
    <div class="modal-content">
    {{ Form::open([
        'method' => 'POST',
        'id' => 'stop-form'
    ]) }}
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
            <h4 class="modal-title">Stop Confirmation</h4>
        </div>
        <div class="modal-body">
            <div class="form-group">
                <label>Are you sure want to stop the process?<br>This DO no longer useable</label>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn sbold btn-danger" type="submit"> 
                </i> Yes
            </button>
            <button type="button" class="btn sbold blue" data-dismiss="modal">No</button>
        </div>
    {{ Form::close() }}
    </div>
</div>

any idea ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看