AJAX POST REQUEST抛出MethodNotAllowedHttpException($ others);

时间:2015-03-07 15:59:53

标签: php jquery ajax laravel

我不知道我做错了请帮忙!

我在观点中有这个

<div class="search">
    {{Form::open(array('url'=>'','method' => 'post'))}}
        {{Form::text('keyword',null,array(
            'class' => 'form-control input-lg',
            'placeholder' => 'Enter keyword...(e.g. post title)'
        ))}}<bR>
        <div class="submit1">
        {{Form::submit('Search',array(
            'class' => 'btn btn-info btn-lg btn-block',
        ))}}
        </div>
    {{Form::close()}}
    </div>
<br>
    <div class="searchs">
    <div class="table-responsive">
        <table class="table table-bordered">
            <thead>
                <th>Title</th>
                <th>Date Created</th>
                <th>Actions</th>
            </thead>

            <tr>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </table>
    </div>
    </div>

<script>
    $(document).ready(function(){

            $('form').submit(function(e){

                e.prevenDefault();

                var formData = new FormData();

                $.ajax({
                    url:'admin/search',
                    method:'post',
                    processData:false,
                    contentType:false,
                    cache:false,
                    dataType: ,
                    sucess:function(data){},
                    error:function(){}
                });
    });
</script>

和我的路线

Route::get('/admin', array(
            'uses' => 'AdminController@index',
            'as' => 'index'
            ));
        Route::post('/admin/search', array(
            'uses' => 'AdminController@search',
            'as' => 'search'
            ));

我只是想知道我做错了什么,或者如果我错过了什么我真的想学习ajax但我坚持这个...我希望有人可以帮助这个

0 个答案:

没有答案