2017-08-14 80 views
0

我使用visual studio 2015來使用cordova構建android應用程序。它在模擬器中工作正常。但是當我釋放它時,ajax請求失敗,因爲在emulator.no上工作的相同的東西在日誌中看到錯誤,但只有ajax錯誤。Ajax請求在Cordova應用程序中失敗Visual Studio

var url = 'http://oployeelabs.net/demo/demo_doctorola/doctorola-server/index.php/doctor_panel_api/validation_modified/format/json'; 
load(); 
$.ajax({ 
    url: url, 
    data: { cell_no: phone, pass: pass }, 
    method: 'POST', 
    dataType: 'json', 
    success: function (data) { 
     alert(); 
     if (data == "false") 
     { 
      alert("Wrong password"); 
     } 
     else 
     { 
      localStorage.doctorid = data[0].id; 
      localStorage.userinfo = JSON.stringify(data); 
      $.ajax({ 
       url: "http://oployeelabs.net/demo/demo_doctorola/doctorola-server/index.php/api/information/meta-info/location/id/"+data[0].id+"/username/9791a47fef07649b1c3e70749e898153/password/2d593e25d0560b19fd84704f0bd24049/format/json", 
       method: 'GET', 
       dataType: 'json', 
       success: function (dt) { 

        localStorage.Chamberinfo = JSON.stringify(dt); 
        mainView.router.loadPage({ url: 'menu.html', ignoreCache: true, reload: true }) 
        $('.toolbar').removeClass('hide'); 

       } 
      }); 


     } 

     //if (data === "ok") { 
     // $(".confirm_appointment").remove(); 
     // var anc = "<a id='confirm_appointment' class='confirm_appointment' style='opacity: 0;' href='confirm.html' data-context='{\"slot_id\": \"" + slot_id + "\",\"slot_date\": \"" + slot_date + "\", \"email\": \"[email protected]\"}'>profile</a>"; 
     // $(document).find('.page_content').append(anc); 
     // $(".confirm_appointment")[0].click(); 
     //} 
     //else { 
     // myApp.hidePreloader(); 
     // myApp.alert("", "Sorry, this slot has been booked. Please try with another slot."); 
     //} 
    }, 
    error: function (xhr, status, exception) { 
     alert(xhr.responseText+" "+status+" "+ exception); 
     console.log("Error: " + xhr.responseText + " - " + exception); 
    }, 
    complete: function() { 
     myApp.hidePreloader(); 
     unload(); 
    } 
}); 
+0

什麼是ajax錯誤?請發佈ajax錯誤的詳細信息。 –

+0

其未發現錯誤 –

+0

@Borshon saydur rahman你可以發佈你的示例代碼 – Madpop

回答

0

奇怪的是,它在我卸載白名單插件後再次安裝它。我不知道爲什麼,但我認爲它是一個科爾多瓦的錯誤。