function memberRegister()
{
document.getElementById("register_validation").innerHTML = "";
var firstname = document.forms["dialog_form_register"]["firstname"].value.trim();
var lastname = document.forms["dialog_form_register"]["lastname"].value.trim();
var email = document.forms["dialog_form_register"]["email"].value.trim();
var password = document.forms["dialog_form_register"]["password"].value.trim();
var repassword = document.forms["dialog_form_register"]["repassword"].value.trim();
var mobile = document.forms["dialog_form_register"]["mobile"].value.trim();
if (document.forms["dialog_form_register"]["checkbox_tnc"].checked==false)
{
document.getElementById("register_validation").innerHTML = "
Please accept the Terms and Conditions to proceed.
";
return;
}
if (password!=repassword)
{
document.getElementById("register_validation").innerHTML = "
Password doest not match
";
return;
}
//alert("ajax_ cala:"+ $("#dialog_form_register").serialize());
$.ajax({
url : '/ajax_api/member_register.jsp',
type: 'POST',
data: $("#dialog_form_register").serialize(),
success : function(data,status, jqXHR)
{
//alert(data);
var obj = JSON.parse(data);
if (obj.resultCode=="0000")
{
//reload the data
//document.getElementById("register_result").innerHTML = "";
document.getElementById("register_result").innerHTML = "
"+obj.message+"
";
//location.reload();
setTimeout(function(){
location.reload();
},500);
}
else
{
//show for the error
document.getElementById("register_result").innerHTML = "
"+obj.message+"
";
}
}
,
error: function (jqXHR, status, err) {
},
complete: function (jqXHR, status) {
setTimeout(function(){
},200);
}
})
}
function checkemail(email){
var testresults= true;
var str=email;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
testresults=false
}
return (testresults)
}
function isEmptyString(str) {
var ans = 0
var ansStr = ""
if (str=="") return 1
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, 1)
if (ch != " ")
ansStr += ch
}
if (ansStr == "")
ans = 1
return ans
// answer 1 if it is an empty string, otherwise answer 0.
}
function passwordReset()
{
var email = document.forms["dialog_form_pw_reset"]["email_recovery"].value;
var lastsesison = document.forms["dialog_form_pw_reset"]["lastsesison"].value;
if (isEmptyString(email) )
{
document.getElementById("recovery_result").innerHTML = "
? required field(s)
";
return;
}
if (checkemail(email)==false)
{
document.getElementById("recovery_result").innerHTML = "
Please fill in correct email
";
return;
}
var dataString= 'email='+ email +'&lastsesison='+ lastsesison;
var actionURL='/ajax_api/member_password_reset.jsp';
document.getElementById("login_result").innerHTML ="";
getResetPWResult(actionURL,dataString);
}
function getResetPWResult(actionURL, dataString) {
$.ajax({
url : actionURL,
type: 'POST',
data: dataString,
success : function(data,status, jqXHR)
{
//alert(data);
var obj = JSON.parse(data);
if (obj.resultCode=="0000")
{
//reload the data
document.getElementById("dialog_form_pw_reset").innerHTML = "
The new password has been sent, please check the password from your email.
";
//document.getElementById("dialog_form_pw_reset").innerHTML = "";
// if (obj.resultURL){
// window.location.href=obj.resultURL;
// }
// else
// {
// location.reload();
// }
}
else
{
//show for the error
document.getElementById("dialog_form_pw_reset").innerHTML = "
"+obj.message+"
";
}
}
,
error: function (jqXHR, status, err) {
},
complete: function (jqXHR, status) {
setTimeout(function(){
},200);
}
})
}
function memberLogin()
{
var email = document.forms["login_form"]["email"].value;
var password = document.forms["login_form"]["password"].value;
var lastsesison = document.forms["login_form"]["lastsesison"].value;
if (isEmptyString(email) || isEmptyString(password))
{
document.getElementById("login_result").innerHTML = "