Generate js code to randomly select a value from the form and fill the text boxes with…
- User
Generate js code to randomly select a value from the form and fill the text boxes with "None."
var request = $.ajax({ url: "getModules.htm", type: "POST", cache: false }); request.done(function (json) { var inhtml = ""; json.sort(function (a, b) { return (a.display_order - b.display_order); }); $.each(json, function (index, item) { if (index === 9) { inhtml += "<li class='dropdown'> " + "<a aria-expanded='true' href='#' class='dropdown-toggle' data-toggle='dropdown'><i class='fa fa-bars fa-lg fa-border'></i> More <b class='caret'></b></a> " + "<ul class='dropdown-menu'>"; } inhtml += "<li><a href='menulist.htm?module_id=" + item.module_id + "'><i class='fa " + item.fa_icon + " fa-lg'></i> <strong>" + item.module_short_desc + "</strong></a></li>"; }); if (json.length > 7) { inhtml += "</ul></li>"; } $("#moduleUL").html(inhtml); }); }); function showSwitch() { var request = $.ajax({ url: "getSwitchableUsers.htm", type: "POST", cache: false }); request.done(function (json) { $('#switchModalLabel').html('List of account available for switching'); var cnt = 0; $('#switchModalBody').html(""); if (json.length > 0) { $.each(json, function (index, item) { $('#switchModalBody').append("<div class='row'>"); if(item.switch_yn.length>0) $('#switchModalBody').append("<div class='well well-sm col-lg-4' style='margin-bottom: 0px;'><a href='#' onclick='switchUser(\"" + item.switch_code + "\")'>" + item.switch_code + "</a></div><div class='well well-sm col-lg-8' style='margin-bottom: 0px;'>" + item.switch_name + "</div>"); else $('#switchModalBody').append("<div class='well well-sm' style='margin-bottom: 0px;'>No account available for switching</div>"); $('#switchModalBody').append(item.switch_ad); $('#switchModalBody').append("</div>"); }); } else { $('#switchModalBody').append("<div class='row'>"); $('#switchModalBody').append("<div class='well well-sm' style='margin-bottom: 0px;'>No account available for switching</div>"); $('#switchModalBody').append("</div>"); } $('#switchModalFooter').html('<button type="button" class="btn btn-primary" '); $('#switchModal').modal('show'); }); } function switchUser(switch_code) { var f = document.createElement("form"); f.setAttribute('method', "post"); f.setAttribute('action', "switchacc.htm"); var switch_code_el = document.createElement("input"); //input element, text switch_code_el.setAttribute('type', "text"); switch_code_el.setAttribute('name', "switch_code"); switch_code_el.setAttribute('value', switch_code); f.appendChild(switch_code_el); document.getElementsByTagName('body')[0].appendChild(f); f.submit(); } var xmlHttp; function GetXmlHttpObject() { var xmlHttp = null; try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function autoRunHoldSession() { setTimeout("autoRunCallHoldSession()", 27 * 60 * 1000); } function autoRunCallHoldSession() { holdSessionAjax(); setTimeout("autoRunCallHoldSession()", 27 * 60 * 1000); } function holdSessionAjax() { xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("Your browser does not support AJAX! Please install latest version of browsing software."); return; } //var url="./holdSession.jsp?rand_id="+Math.round(Math.random()*100000); var url = "./holdSession.htm?rand_id=" + Math.round(Math.random() * 1000000000000000); xmlHttp.onreadystatechange = holdSession; xmlHttp.open("GET", url, true); xmlHttp.send(null); //alert("here11"); //setTimeout(getPendingCAS(ca_user_code),100000); return true; } function holdSession() { var temp_html = ""; if (xmlHttp.readyState == 4) { temp_html = xmlHttp.responseText; //alert(temp_html); } } function showComplaintSelection() { $('#complaintSelectionModal').modal('show'); - Assistant