$ .ajax不是vue组件中的函数

时间:2019-11-23 17:02:23

标签: javascript jquery vue.js

我在vue组件中使用jquery ajax,但收到错误$.ajax is not a function,但我进行了测试,可以使用jquery从DOM中获取Html元素,但为什么不使用ajax?

<template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">Example Component</div>

                    <div class="card-body">
                        I'm an example component.
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    //this is for test  and it work
    var a = $('.card-body');
    console.log(a);
    //jquery its's working why not $.jax
    $.ajax({
        url: "127.0.0.1:8000/tasks",
        method:'GET'
    }).done(function(response) {
        console.log(response);
    });
</script>

0 个答案:

没有答案