未捕获的TypeError:$ .get(...)。然后不是函数

时间:2017-05-04 19:25:17

标签: javascript jquery angularjs

这是我的代码..我在控制台中收到错误,因为Uncaught TypeError:$ .get(...)。然后不是函数..错误是在第18行

root@getyou:/home# grep "server_name" /home/site-configs/getyou
        getyou.onl
root@getyou:/home# grep "server_name" /home/site-configs/kevinpirnie
        kevinpirnie.com
root@getyou:/home# grep "server_name" /home/site-configs/airsweepinc
        airsweepinc.com
root@getyou:/home# grep "server_name" /home/site-configs/themedepot
        theme-depot.net

1 个答案:

答案 0 :(得分:0)

尝试使用此 -

<button class="btn btn-primary" id="requestButton">HTTP Request</button>
<ul id="myList"></ul>
<script type="text/javascript">
    var ulElm = document.querySelector("#myList");
    var first = false;
    var chatList;
    function updateChat() {
        console.log("update Chat called");
        $.get("http://projecttester.16mb.com/makejson.php", function(data) {
            if(!first) {
                chatList = JSON.parse(data);
                chatList.forEach(function(item) {
                    var liElm = document.createElement('li');
                    liElm.innerHTML = item.Message;
                    ulElm.appendChild(liElm);
                }
            }
        });
    }
</script>
</body>