weixin_33720186 2014-11-09 08:22 采纳率: 0%
浏览 23

自动完成网址AJAX

I want to know where is gsmarena.com put ajax url when they do a search. I tried to explore the source of it and I found this function:

function autocompleteLoadList() {
    if (AUTOCOMPLETE_LIST !== null) return;
    AUTOCOMPLETE_LIST = false;
    var xhr;
    if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest
    } else if (window.ActiveXObject) {
        try {
            xhr = new ActiveXObject("Msxml2.XMLHTTP")
        } catch (x) {
            try {
                xhr = new ActiveXObject("Microsoft.XMLHTTP")
            } catch (x) {
                AUTOCOMPLETE_LIST = null
            }
        }
    }
    xhr.open("GET", AUTOCOMPLETE_LIST_URL, true);
    xhr.onreadystatechange = function(e) {
        if (xhr.readyState == 4)
            if (xhr.status == 200) {
                var data;
                if (window.JSON) {
                    data = JSON.parse(xhr.responseText)
                } else {
                    data = eval("(" + xhr.responseText + ")")
                }
                AUTOCOMPLETE_MAKERS = data[0];
                AUTOCOMPLETE_LIST = data[1];
                if (typeof AUTOCOMPLETE_CALLBACK != "undefined") AUTOCOMPLETE_CALLBACK()
            } else {
                AUTOCOMPLETE_LIST = null
            }
    };
    xhr.send(null)
}

http://cdn2.gsmarena.com/w/js/autocomplete.js?ver=2

I do not know where they put the url to doing a search.

when I open the network tab in Google Chrome console there is also no url to POST or GET. how could they do it?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请问如何在openpcdet上对KITTI数据集的测试集进行结果评估?
    • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
    • ¥20 有人知道这种图怎么画吗?
    • ¥15 pyqt6如何引用qrc文件加载里面的的资源
    • ¥15 安卓JNI项目使用lua上的问题
    • ¥20 RL+GNN解决人员排班问题时梯度消失
    • ¥60 要数控稳压电源测试数据
    • ¥15 能帮我写下这个编程吗
    • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
    • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错