在线运行的ajax问题 [英] problem in ajax running in online
本文介绍了在线运行的ajax问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用asjx文件中的ajax json,web方法登录。
在本地主机上工作正常。当我在线上传它时。然后它将转向ajax的错误部分。并显示Undefined作为错误信息。
我用过的代码。
i am doing login with ajax json, web method in asmx file.
in local host its working fine.bt when i am uploaded it online. then its going to error part of ajax. and showing "Undefined" as a error message.
code bellow i have used.
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.d);
$('.loading_login').hide();
},
error: function (response) {
$("#btnLogin").attr("disabled", "disabled");
alert('Sorry! Error.');
alert(response.d);
$('.loading_login').hide();
},
});
}
clearAll();
}
请说出错误在哪里...
谢谢
please say where is the error...
thanks
推荐答案
( #btnLogin )。attr( disabled, disabled);
("#btnLogin").attr("disabled", "disabled");
(' .loading_login')。show();
var email = document .getElementById( txtLoginEmail)。value;
var password = document .getElementById( txtLoginPassword)。value;
if (email == || password == ){
alert(' 填写数据');
('.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 ;
}
其他 {
/ * < span class =code-comment>发送链接以获取详细信息* /
var input = email + +密码; / * 按空格检测* /
('.loading_login').hide(); return; } else { /* send the link to fetch details */ var input = email + " " + password; /* detect by space */
这篇关于在线运行的ajax问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文