JezK
Edit File: functions.js
function readURL(input,id) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function(e) { $('#'+id).attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } function addUserValidation() { var phoneno = /^\d{5,15}$/; var email=$('#email').val(); var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var fuData = document.getElementById('profilePicture'); var FileUploadPath = fuData.value; var Extension = FileUploadPath.substring(FileUploadPath.lastIndexOf('.') + 1).toLowerCase(); if(FileUploadPath == '' ) { alert("Please upload an image"); return false } else if (Extension != "png" && Extension != "jpeg" && Extension != "jpg" && FileUploadPath!='') { alert("Please upload png or jpg images");return false; } else if($('#fullname').val()=='') { alert("Please enter Full Name"); return false; } else if(email=='') { alert("Please enter Email"); return false; } else if (reg.test(email) == false) { alert("Please enter valid email address"); return false; } else if($('#username').val()=='') { alert("Please enter Username"); return false; } else if(($('#username').val()).length<='3') { alert("Username must be more then 3 characters"); return false; } else if($('#mobile').val()=='') { alert("Please enter Mobile Number"); return false; } else if(!$('#mobile').val().match(phoneno)) { alert("Please enter valid Mobile Number"); return false; } else if($('#location').val()=='') { alert("Please enter Location"); return false; } else if($('#password').val()=='' ) { alert("Please enter Password"); return false; } else if($('#password').val().length<=5) { alert("Password must be more than five characters"); return false; } else if($('input[id="agree"]:checked').val()!='1' ) { alert("Please select the terms and conditions"); return false; } return true; } function blockorunblock(status,id,aid) { let statusmsg='Block'; if(status==0) { statusmsg='Unblock' } if(confirm('Are you sure want to '+statusmsg+' the business?')) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if(this.responseText==1) { let mystatus=0; let changetext="Unblock"; if(status==0) { changetext="Block"; mystatus=1; } //$('#'+aid).text(statusmsg); document.getElementById("blockid"+aid).innerHTML=changetext; document.getElementById("blockid"+aid).setAttribute("onClick", "blockorunblock("+mystatus+",'"+id+"',"+aid+");"); alert('Successfully '+statusmsg); }else{ alert("Status updation was failed"); } return false; } } xmlhttp.open("POST", "ajax.php?action=blkunblkBusiness&bid="+id+"&status="+status, true); xmlhttp.send(); } else{ return false; } } $(".toggle-password").click(function() { $(this).toggleClass("showHide"); var input = $($(this).attr("toggle")); if (input.attr("type") == "password") { input.attr("type", "text"); document.getElementById("show").innerHTML = "Hide"; } else { input.attr("type", "password"); document.getElementById("show").innerHTML = "Show"; } }); function deleteall(typeofdel) { if(confirm('Are you sure want to delete?')) { var testval = []; $('.checkmark:checked').each(function() { testval.push($(this).val()); }); if(testval.length<=0) { alert('Please select atleast one record to delete'); return false; }else{ document.getElementById(typeofdel).submit(); } }else{ return false; } }