Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未找到返回数据对象的Ajax轮询获取url_Javascript_Jquery_Ajax - Fatal编程技术网

Javascript 未找到返回数据对象的Ajax轮询获取url

Javascript 未找到返回数据对象的Ajax轮询获取url,javascript,jquery,ajax,Javascript,Jquery,Ajax,我正在尝试进行ajax轮询以刷新我的message div,但我的控制台中出现以下错误: http://localhost/~userb/grind/dashboard/[object%20Object] 404 (Not Found) send @ jquery.min.js:4 ajax @ jquery.min.js:4 n.(anonymous function) @ jquery.min.js:4 update_chat @ convo.js:8 jquery.min.js:4 GE

我正在尝试进行ajax轮询以刷新我的message div,但我的控制台中出现以下错误:

 http://localhost/~userb/grind/dashboard/[object%20Object] 404 (Not Found)
send @ jquery.min.js:4
ajax @ jquery.min.js:4
n.(anonymous function) @ jquery.min.js:4
update_chat @ convo.js:8
jquery.min.js:4 GET
以下是轮询的JS片段:

setInterval(update_chat, 2000);

    function update_chat()
    {
        var enquiryId = parseInt($('#messageMain').data('id'));

        $.get({url: '../includes/polling.php?id=' + enquiryId})
        .done(function(data) {
            $('#messageMain').html(data);
        });
    }
html:

<div class="panel panel-primary">
    <div class="panel-heading">
        <span class="glyphicon glyphicon-comment"></span> Chat
    </div>
    <div class="panel-body">
        <ul class="chat" id="messageMain" data-id="<?= $to_id ?>"> <!-- $to_id is what is used to get the messages -->
            <!-- all messages are queried from database here -->
        </ul>
    </div>
    <div class="panel-footer">
        <div class="input-group">
            <input id="btn-input" type="text" class="form-control input-sm" data-to="<?= $to_id ?>" placeholder="Type your message here...">
            <span class="input-group-btn">
                <button class="btn btn-warning btn-sm" id="btn-chat">
                    Send</button>
            </span>
        </div>
    </div>
</div>

闲聊
将
$.get({url:'../includes/polling.php?id='+inquiryId})更改为
$.get('../includes/polling.php?id='+inquiryId)


url直接作为.get()的第一个参数进入。

请发布您的HTML好吗?谢谢@克里斯托斯添加了HTML。谢谢你的帮助:)