Please Help to bypass otp in this code.
i want the same result if i enter wrong otp or i dont want to enter any otp.
i just want the otp correct result action to wrong otp enter.
kinldy help to this. please rewrite the code according to it.
hope i will help some help....
i dont have any programme knowledge.
so please just provide me the rewrite code.
var notime=0;
$( document ).ready(function() {
var length = $('#state_name > option').length;
if(length > 1){
$("#state_name").prepend("<option value='OT' selected='true'>--Select State Name--</option>");
$("#state_code").prepend("<option value='OT' selected='true'>--Select State Code--</option>");
$("#rto_div").hide();
}else{
getrtobystate();
var rtolength = $('#rto_code > option').length;
if(rtolength <=2 ){
$("#rto_name").find("option").eq(0).remove();
$("#rto_code").find("option").eq(0).remove();
$(document).ready(function(){
$("#other_det").show();
});
}
}
function backtohome(){
// window.location.href="sarathiHomePublic.do";
window.location.href = "./";
}
$("#other_det").hide();
$(function() {
$( "#dob" ).datepicker( {
changeYear : true,
changeMonth : true,
yearRange : "-70Y:-15Y",
dateFormat : "dd-mm-yy",
defaultDate : new Date(new Date().getFullYear() - 15,
new Date().getMonth(), new Date().getDate())
});
});
$("#resultData").hide();
});
$( "#state_name" ).change(function() {
document.getElementById("state_code").selectedIndex = document.getElementById("state_name").selectedIndex;
if(document.getElementById("state_code").selectedIndex==0)
{
$("#other_det").hide();
$("#rto_div").hide();
}
else
getrtobystate();
});
$( "#state_code" ).change(function() {
document.getElementById("state_name").selectedIndex = document.getElementById("state_code").selectedIndex;
if(document.getElementById("state_code").selectedIndex==0)
{
$("#rto_div").hide();
$("#other_det").hide();
}
else
getrtobystate();
});
$( "#rto_name" ).change(function() {
document.getElementById("rto_code").selectedIndex = document.getElementById("rto_name").selectedIndex;
if(document.getElementById("rto_code").selectedIndex!=0)
$("#other_det").show();
else
$("#other_det").hide();
});
$( "#rto_code" ).change(function() {
document.getElementById("rto_name").selectedIndex = document.getElementById("rto_code").selectedIndex;
if(document.getElementById("rto_code").selectedIndex!=0)
$("#other_det").show();
else
$("#other_det").hide();
});
$( "#submitbtn" ).click(function() {
if(document.getElementById("state_name").selectedIndex==0 && $("#loginstatus").val()=="no")
{
$("#other_det").hide();
alert("Enter State Name");
}
else if(document.getElementById("rto_name").selectedIndex==0 && $("#loginstatus").val()=="no")
{
$("#other_det").hide();
alert("Enter Rto Name");
}
else if($("#applFname").val()=="")
{
$('.ajaxerror h4').text("Enter First name");
$('.ajaxerror').modal({keyboard: false,backdrop: 'static'});
}
else if($("#dob").val()=="" && $("#loginstatus").val()=="no")
{
$('.ajaxerror h4').text("Enter Date of birth");
$('.ajaxerror').modal({keyboard: false,backdrop: 'static'});
}
else if(!/^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/.test($("#dob").val()) && $("#loginstatus").val()=="no")
{
$('.ajaxerror h4').text("Enter valid Date of birth");
$('.ajaxerror').modal({keyboard: false,backdrop: 'static'});
}
else if($("#captxt").val()=="" && $("#loginstatus").val()=="no")
{
$('.ajaxerror h4').text("Enter captcha");
$('.ajaxerror').modal({keyboard: false,backdrop: 'static'});
}
else
getdetails();
});
$( "#reset" ).click(function() {
window.location.href = "";
});
$( "#home,#back").click(function() {
window.location.href = "./";
});
function changeCaptcha()
{
$("#capimg").attr("src", "jsp/common/captchaimage.jsp?"+(new Date().getTime()));
}
function getrtobystate()
{
var retVal;
$.ajax({
url : 'applnoSearchajax.do',
type : 'GET',
async : false,
cache : false,
data : {
cntrtype : "ajax",
cntrper : "rto",
selstate : document.getElementById("state_name").value,
},
success : function(data) {
var parsed = JSON.parse(JSON.stringify(data));
retVal = [];
$('#rto_name').find('option:gt(0)').remove();
$('#rto_code').find('option:gt(0)').remove();
for(var x in parsed){
var temp=[];
$('#rto_name').append($('<option>', {
value: x,
text: parsed[x]
}));
$('#rto_code').append($('<option>', {
value: x,
text: x
}));
$("#rto_div").show("slow");
retVal.push(x);
retVal.push(parsed[x]);
}
console.log("Data-->" + retVal);
},
error : function(e) {
//called when there is an error
console.log(e.message);
}
});
return retVal;
}
function getdetails()
{
$('.ajaxLoading').modal({
backdrop: 'static',
keyboard: false
});
$("body").css("cursor", "progress");
var retVal;
$.ajax({
url : 'applnoSearchajax.do',
type : 'GET',
async : true,
cache : false,
data : {
cntrtype : "ajax",
cntrper : "details",
captcha : document.getElementById("captxt").value,
fname : document.getElementById("applFname").value,
dob : document.getElementById("dob").value,
rtoCd : document.getElementById("rto_code").value
},
success : function(data) {
if(data == "no")
{
$('.ajaxerror h4').text("Invalid Captcha!!");
$('.ajaxerror').modal({keyboard: false,backdrop: 'static'});
}
else if(data == "No records")
{
$('.ajaxerror h4').text("No Records Found");
$('.ajaxerror').modal({keyboard: false,backdrop: 'static'});
$("#resultData").html("");
//$("#dispResult").hide();
//alert("in no rec found");
}
else{
try{
$("#resultData").html("");
console.log(data);
console.log(Object.keys(data).length);
var str = "<table class=\"table table-bordered table-hover\" id=\"dispResult\"><tr><td>S.No</td><td>Applicant Full Name</td><td>Father Name</td><td>Transaction Name</td><td>Phone Number</td><td></td></tr>";
for(var i in data){
console.log("Test"+data[i].applFullName);
/*if(data[i].transName == "null" || data[i].transName == null)
data[i].transName = "NA";*/
//var j=i+1;
if($("#loginstatus").val()=="no")
str = str+"<tr><td>"+data[i].slno+"</td><td>"+(data[i].applFullName).replace(/[^\w\s]/gi,' ')+"</td><td>"+(data[i].fatherName).replace(/[^\w\s]/gi,' ')+"</td><td>"+(data[i].transName == null ? "---" : data[i].transName)+"</td><td>"+(data[i].phno == null ? "---" :data[i].phno ) +"</td><td><input type=\"button\" value=\"Get Details\" class=\"btn btn-success\" onclick=\"getOTP("+data[i].slno+",\'first\')\"/></td></tr>";
else{
str = str+"<tr><td>"+data[i].slno+"</td><td>"+(data[i].applFullName).replace(/[^\w\s]/gi,' ')+"</td><td>"+(data[i].fatherName).replace(/[^\w\s]/gi,' ')+"</td><td>"+(data[i].transName == null ? "---" : data[i].transName)+"</td><td>"+(data[i].phno == null ? "---" :data[i].phno ) +"</td><td><input type=\"button\" value=\"Get Details\" class=\"btn btn-success\" onclick=\"redirectingtostatus("+data[i].applno+",\'first\')\"/></td></tr>";
}
}
// str = str.replace("$", ' ');
// str = str.replace("$$", ' ');
str = str+"</table>";
console.log(str);
$("#resultData").append(str);
$("#resultData").show();
$('#dispResult').jqTable({
searchInHiddenContent: true,
differentRowsPerPage: [5,10,50,100],
defaultOrderBy: 0,
headerInSearch: [0,1,2,3],
template: 1,
});
//$("#dispResult_jqTable").attr("id","dispResult");
}catch (e) {
console.log(e);
}
}
$("body").css("cursor", "default");
changeCaptcha();
$("#captxt").val("");
$('.ajaxLoading').modal('hide');
},
error : function(e) {
changeCaptcha();
//called when there is an error
console.log(e.message);
}
});
return retVal;
}
function getOTP(slno,status)
{
/* $('.confirmotp').modal('hide');
$('.ajaxLoading').modal({
backdrop: 'static',
keyboard: false
}); */
var retVal;
$.ajax({
url : 'applnoSearchajax.do',
type : 'GET',
cache : false,
data : {
cntrtype : "ajax",
cntrper : "sendsms",
srlno : slno,
},
success : function(data) {
console.log("Data-->" + data);
$('.ajaxLoading').modal('hide');
$("#otpstatus").show();
$("#otpresend").attr("onclick","getOTP("+slno+",\'resend\')");
$("#otptext").val("");
$('.confirmotp').modal({keyboard: false,backdrop: 'static'});
if(data == "yes")
$("#otpstatuserr").hide();
else{
//alert("data--"+data);
$("#otperr").html("OTP not sent, please click on resend");
$("#otpstatuserr").show();
$("#otpstatus").hide();
}
},
error : function(e) {
//called when there is an error
console.log(e.message);
}
});
return retVal;
}
function checkotp()
{
$('.confirmotp').modal('hide');
$('.ajaxLoading').modal({
backdrop: 'static',
keyboard: false
});
var retVal;
$.ajax({
url : 'applnoSearchajax.do',
type : 'GET',
cache : false,
data : {
cntrtype : "ajax",
cntrper : "checkotp",
otp : $("#otptext").val(),
},
success : function(data) {
console.log("Data-->" + data);
$('.ajaxLoading').modal('hide');
if(data!="no"){
var str=data.split("@");
$("#applNum").val(str[0]);
$("#dateOfBirth").val(str[1]);
$("#applviewform").submit();
}
else{
$("#otperr").html("Invalid OTP");
$("#otpstatuserr").show();
$("#otpstatus").hide();
$('.confirmotp').modal({keyboard: false,backdrop: 'static'});
}
//window.location.href = "./"+data;
},
error : function(e) {
//called when there is an error
console.log(e.message);
}
});
return retVal;
}
function redirectingtostatus(number){
$("#papplno").val(number);
$("#applNum").val(number);
$("#applviewformforlogin").submit();
}
Aucun commentaire:
Enregistrer un commentaire