i am using ajax json to make a login function, and put the web method in asmx file.
in local host its working fine. bt when i upload this one. its every time goes to error part of the ajax and showing error "Undefined".
code is...
function login() {
$("#btnLogin").attr("disabled", "disabled");
$('.loading_login').show();
var email = document.getElementById("txtLoginEmail").value;
var password = document.getElementById("txtLoginPassword").value;
if (email == "" || password == "") {
alert('Fill up data');
$('.loading_login').hide();
return;
}
else {
/* send the link to fetch details */
var input = email + " " + password; /* detect by space */
$.ajax(
{
type: 'POST',
url: 'ChangePassword.asmx/Login',
data: '{\'inputText\':\'' + input + '\'}',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
success: function (response) {
if (response != null && response.d != null) {
alert('done');
if (response.d != "Success") {
$("#btnLogin").prop("disabled", false);
alert('Wrong email & password !');
$('.loading_login').hide();
}
else {
$("#btnLogin").prop("disabled", false);
window.location = "home.aspx";
alert('welcome');
$('.loading_login').hide();
}
}
},
failure: function (response) {
$("#btnLogin").attr("disabled", "disabled");
alert('Sorry! Operation failed.');
alert(response.responseText);
$('.loading_login').hide();
},
error: function (response) {
$("#btnLogin").attr("disabled", "disabled");
alert('Sorry! Error.');
alert(response.d);
$('.loading_login').hide();
},
});
}
clearAll();
}