我有function(ionic1)调用POST数据到RestAPI(WebAPI MVC)。在命令终端显示以下错误“ ionic cordova run android -device -l”。 但是我和邮递员测试没关系。
function save(){
jQuery.support.cors = true;
var Patient = {
Patient_Id: 5
, Patient_Prefix: document.getElementById("txtprefix").selectedIndex
, Patient_Name: $('#txtname').val()
, Patient_Email: $('#txtemail').val()
, Patient_Tel: $('#txtteldoc').val()
, Patient_Address: $('#txtIP').val()
, Patient_Birthday: $('#txthbd').val()
, Patient_Username: $('#patientusername').val()
, Patient_Password: $('#txtPassword').val()
, Patient_TelFamily: $('#txttelfamily').val()
, Patient_CardId: $('#txtcardid').val()
, Patient_Allergy: $('#txtAllergy').val()
, Patient_IsApprove: 0
, Patient_IsApproveText: ""
, Patient_Token: $('#txttoken').val()
};
$.ajax({
url: uripatient + '/y',
//xhrFields: 'withCredentials:true',
type: 'POST',
data: JSON.stringify(Patient),
contentType: "application/json;charset=utf-8", //contentType: "application/json;charset=utf-8" "application/x-www-form-urlencoded; charset=UTF-8"
success: function (data) {
// alert(data);
},
error: function (x, y, z) {
// alert(x + '\n' + y + '\n' + z);
}
});
}