<table width="1000px" border="0" align="center" cellpadding="0" cellspacing="0" id="__01"> <tr> <td style="text-align: center; vertical-align: middle;"> <div class="easyui-panel" style=" 640px; height: 260px; padding: 10px;"> <p><b>ShareFolder Path: </b><span id="shareFolderPath"></span></p> <p><b>Files to process </b>(Person xml file count <span id="personCount" style="color: red;">0</span>, Entity xml file count <span id="entityCount" style="color: red;">0</span>)</p> <p><b>Result: </b><span id="parsingResult"></span></p> </div> </td> </tr> <tr> <td height="50" align="center" valign="middle"> <input type="button" id="btnStartParsing" name="btnStartParsing" value="Start Parsing" /> <input type="button" id="btnTest" name="btnTest" value="Test" /> </td> </tr> </table>
<script type="text/javascript"> var url = window.location.href.toLocaleLowerCase().replace("index.aspx", "Handler.ashx"); $(document).ready(function () { getShareFolderPath(); loadShareFolderXml(); $("#btnStartParsing").click(function () { return btnParsingOnClick(); }); $("#btnTest").click(function () { return btnTestOnClick(); }); }); function getShareFolderPath() { $.ajax({ type: "GET", url: url + "?action=getsharefolderpath&r=" + Math.random(), dataType: "json", data: null, async: true, success: function (json) { if (json.result) { $("#shareFolderPath").html("<a href="" + json.data + "" target="_blank">" + json.data + "</a>"); } else { alert(json.msg); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }) } function loadShareFolderXml() { $.ajax({ type: "GET", url: url + "?action=initfolder&r=" + Math.random(), dataType: "json", data: null, success: function (json) { if (json.result) { if (json.data.personCount != null) { $("#personCount").text(json.data.personCount); } if (json.data.personCount != null) { $("#personCount").text(json.data.entityCount); } if (parseInt(json.data.personCount) > 0 || parseInt(json.data.entityCount) > 0) { $("#btnStartParsing").prop("disabled", false); $("#btnStartParsing").removeAttr("disabled"); } else { $("#btnStartParsing").prop("disabled", true); } } else { $("#btnStartParsing").prop("disabled", true); alert(json.msg); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { $("#btnStartParsing").prop("disabled", true); alert(textStatus); } }) } function btnParsingOnClick() { $.ajax({ type: "GET", url: url + "?action=startparsing&r=" + Math.random(), dataType: "json", data: null, async: true, beforeSend: function () { //$("#btnStartParsing").prop("value", "Processing, please wait...,Do not click again or close page"); $("#btnStartParsing").val("Processing, please wait...,Do not click again or close page"); $("#btnStartParsing").prop("disabled", true); }, success: function (json) { $("#parsingResult").text(json.msg); loadShareFolderXml(); }, complete: function () { $("#btnStartParsing").val("Start Parsing"); loadShareFolderXml(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); return false; } function btnTestOnClick() { var btn = $("#btnTest"); //btn.prop("value", "Processing, please wait...,Do not click again or close page"); btn.val("Processing, please wait...,Do not click again or close page"); btn.prop("disabled", true); setTimeout(function () { btn.val("Start Parsing"); btn.prop("disabled", false); }, 5000); return false; } </script>