GIF89a
function updateProfile(user_id) { var uname=$("#uname").val(); var mobb=$("#mobb").val(); var gender=$("#gender").val(); var password=$("#password").val(); var age=$("#age").val(); if(uname=="") { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Enter user name"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#uname").focus(); return false; } if(mobb=="") { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Enter mobile number"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#mobb").focus(); return false; } if(mobb.length!=10) { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Invalid mobile number"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#mobb").focus(); return false; } if(gender=="") { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Select gender"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#gender").focus(); return false; } if(password=="") { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Enter password"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#password").focus(); return false; } if(password.length<6 && password.length>20) { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Invalid password"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#password").focus(); return false; } if(age=="") { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Enter age"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#age").focus(); return false; } if(age<18) { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Enter valid age | Greater than 18"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); $("#age").focus(); return false; } if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (this.readyState==4 && this.status==200) { if(this.responseText==1) { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Updated details"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); window.location.href = ("update_user_info.php"); } else { var x = document.getElementById("snackbar"); $("#snack_msgg").html("Unable to update"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000); window.location.href = ("update_user_info.php"); } } }; xmlhttp.open("GET","updateProfile.php?uname="+uname+"&mobb="+mobb+"&gender="+gender+"&password="+password+"&age="+age+"&user_id="+user_id,true); xmlhttp.send(); }