2017-08-14 5 views
0

私はcordovaを使用してAndroidアプリケーションを構築するためにVisual Studio 2015を使用しています。エミュレータで正常に動作します。しかし、私はそれをリリースしているときに、同じことがemulator.noエラーではなく、ajaxエラーだけでログに記録されます。CordovaアプリケーションでAjaxリクエストが失敗する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

ホワイトリストプラグインをアンインストールしてからもう一度インストールしたのは不思議です。私は理由を知りませんが、私はcordovaのバグだと思います。

関連する問題