日期:2014-05-17 浏览次数:20965 次
var loginId = getCookie("UserName"); var flag = "true"; $.ajax({ url: "../Handler/GetUserInfo.ashx?sign=loadInfo&loginId=" + loginId, type: 'get', async: false, dataType: "text", success: function (value) { if (value.toString() == "PleaseLogin") { alert("Please Login Thanks!"); flag = "1"; }else { var val = jQuery.parseJSON(value); if (val.Sign.toString() == "0") { //没有获取到用户信息 var loginName = document.getElementById("loginId").value; if (loginName == null || loginName == "") { document.getElementById("loginId").innerText = val.LoginId; } else { document.getElementById("loginId").value = val.LoginId } alert("Not Get User Info!"); return false; } else { //获取到用户信息 var loginName = document.getElementById("loginId").value; if (loginName == null || loginName == "") { document.getElementById("loginId").innerText = val.LoginId; } else { document.getElementById("loginId").value = val.LoginId } document.getElementById("money").innerText = val.Balance; document.getElementById("address").value = val.Address; document.getElementById("email").value = val.Email; document.getElementById("phone").value = val.Phone; document.getElementById("an1").value = val.Answer1; document.getElementById("an2").value = val.Answer2; //给问题赋值 var q1 = val.Question1; var q2 = val.Question2; var qs1 = document.getElementById("qs1"); var qs2 = document.getElementById("qs2"); for (i = 0; i <= qs1.options.length; i++) { if (qs1.options[i].value == q1) { qs1.options[i].selected = 'selected'; } if (qs2.options[i].value == q2) { qs2.options[i].selected = 'selected'; } } } } } });