У меня разрабатывается одно приложение для Android с использованием Cordova, у меня возникла следующая проблема при вызове API, пожалуйста, помогите мне решить эту проблему
Failed to load resource: net::ERR_CONNECTION_REFUSED(http://ip address:8080)
var uName = $('#UserName_input').val();
var pwd = $('#Password_input').val();
console.log("GetLogin function CallED~~~~~~~~~~~~~");
console.log("GetLogin InternetStatus ~~~~~~~~~~~~~" + InternetStatus);
console.log("GetLogin function uNam~~~~~~~~~~~~~" + uName);
console.log("GetLogin function pwd ~~~~~~~~~~~~~" + pwd);
if (InternetStatus == 'Online') {
if (uName != "" && pwd != "") {
//SpinnerDialog.show("Loading", "Please Wait...", true);
$(".modal").show();
/*---------->*/
// alert("call before AJAX------>");
debugger
$.ajax({
url: baseURL + checkLogin,
type: 'POST',
data: {
'userName': uName,
'password': pwd
},
// ~~~~~~~~~~~~~~~~~ Basic autherntication ~~~~~~~~~~~~~~~~~~~~~~~~
/* beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + btoa("crewMobieAppAdmin" + ":" + "!uT#61@c#"));
},*/
success: function(result)
//we got the response
{
//debugger
console.log("message------>" + result.message + " \n status----->" + result.status);
//console.log(JSON.stringify(row));
if (result.status == "success") {
UserDatails(uName, result.tokenId);
ToastShow("Login Successfully.!!!", "#008000", "#FFFFFF");
USERNAME_localStorage_SET(uName);
PASSWORD_localStorage_SET(pwd);
BASEAUTH_localStorage_SET(result.tokenId);
PIN_localStorage_SET("");
SpinnerDialog.hide();
window.location.href = "home.html"
//$(".modal").hide();
} else {
SpinnerDialog.hide();
ToastShow(result.message, "#FF0000", "#FFFFFF");
// $(".modal").hide();
}
//SpinnerDialog.hide();
// $(".modal").hide();
},
error: function(exception) {
ToastShow("Server not responding. Please try again after some time.!!!", "#FF0000", "#FFFFFF");
console.log('Exception:' + exception);
status = "failur"
// Hide spinner dialog
//SpinnerDialog.hide();
// $(".modal").hide();
}
}) /*<----------*/
// SpinnerDialog.hide();
} else {
ToastShow("Please enter valid username and password.!!!", "#FF0000", "#FFFFFF");
}
} else {
ToastShow("please check your network connection and try again.!!!", "#FF0000", "#FFFFFF");
}