$ .get无法使用chrome但在firefox

时间:2018-02-26 07:00:03

标签: jquery ajax google-chrome

我有一个简单的ajax get request到一个页面但它没有在chrome中触发虽然它在firefox中运行正常但是当我在chrome开发人员工具中检查$.get时它被识别出来。

function callMainOnUnload() {
  ajaxOnunload( 'myProject/index'); 
  );
}

function ajaxOnunload(url) {
    var trackingStr = "&pageName=page1";
    $.get(url + trackingStr, function(data) {})
}

我尝试过的解决方案:

  1. 将我的项目移至服务器并从我本地计算机的浏览器访问它。

  2. 使用以下命令行运行chrome:C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files

  3. 这有点类似于jQuery $.get does not work in Chrome,但那里没有提供解决方案。

    编辑:

    我还试过在chrome控制台中直接运行它。

    $.get('myProject/index' + '&pageName=page1', function(data) {}) 
    

    Chrome识别它并且能够成功触发请求。

    看起来Chrome因某种原因取消了请求

        1348: URL_REQUEST
    http://10.32.1.10:8082/myProj/index?ajax=1&r=0.483360469681553&pageName=PERSONAL_DTLS&emailAddress=&firstName=&lastName=
    Start Time: 2018-02-28 17:08:01.367
    
    t=6488 [st=0] +REQUEST_ALIVE  [dt=1]
                   --> priority = "MEDIUM"
                   --> url = "http://10.32.1.10:8082/myProj/index?ajax=1&r=0.483360469681553&&emailAddress=&firstName=&lastName="
    t=6488 [st=0]    URL_REQUEST_DELEGATE  [dt=0]
    t=6488 [st=0]   +URL_REQUEST_START_JOB  [dt=1]
                     --> load_flags = 33024 (MAYBE_USER_GESTURE | VERIFY_EV_CERT)
                     --> method = "GET"
                     --> url = "http://10.32.1.10:8082/myProj/index?ajax=1&r=0.483360469681553&&emailAddress=&firstName=&lastName="
    t=6488 [st=0]      URL_REQUEST_DELEGATE  [dt=0]
    t=6488 [st=0]      HTTP_CACHE_GET_BACKEND  [dt=0]
    t=6488 [st=0]     +HTTP_CACHE_OPEN_ENTRY  [dt=1]
    t=6488 [st=0]        CANCELLED
    t=6489 [st=1]   -URL_REQUEST_START_JOB
                     --> net_error = -3 (ERR_ABORTED)
    t=6489 [st=1]    URL_REQUEST_DELEGATE  [dt=0]
    t=6489 [st=1] -REQUEST_ALIVE
    

0 个答案:

没有答案