Wait to get response with Add-in Express

Add-in Express™ Support Service
That's what is more important than anything else

Wait to get response with Add-in Express
 
Georges DEME




Posts: 18
Joined: 2017-03-07
Hi ,

How to wait to get the response of a web page until a web request is finished after a click event?

And after we get the response how to get the data by get element by ID.

Thanks!
Georges
Posted 15 Mar, 2017 00:22:20 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Georges,

Can you please clarify the question or just provide an example that reproduces the issue? Do you use the 'WebClient' class to send requests?
Posted 15 Mar, 2017 12:39:13 Top
Georges DEME




Posts: 18
Joined: 2017-03-07
Hi Sergey,

No it's a javascript, and Ajax.


QUESTIONS

1- There is one page but only the body of the content change. This page have 2 bodies contents
- The Search CONTENT , where you type your request and hit the button "Search"
- The result CONTENT, where you can read your response.

That's why DocumentComplete2 is fired when the page is complete at the Search content and don't fired again when at the result content show up.

2- How to find an event which will fired when the result comes'up ?


3- How to get those values below of the result content ?

<input id="CheckInSearch_LicensePlate" name="CheckInSearch.LicensePlate" type="hidden" value="LPKEN000000214228000" />
<input id="CheckInSearch_CPORDNumber" name="CheckInSearch.CPORDNumber" type="hidden" value="OREUSA2318077683DE" />
<input data-val="true" data-val-required="The Is Damaged field is required." id="CheckInSearch_IsDamaged" name="CheckInSearch.IsDamaged" type="hidden" value="False" />
<input data-val="true" data-val-required="The Is Unidentifiable field is required." id="CheckInSearch_Unidentified" name="CheckInSearch.Unidentified" type="hidden" value="False" />
<input id="PIPInfoAggregate_NextRoutingDisposition_Description" name="PIPInfoAggregate.NextRoutingDisposition.Description" type="hidden" value="OpenBox" />



Key Value
X-Requested-With XMLHttpRequest
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Request POST /CheckIn/CheckIn HTTP/1.1



FIRST CONTENT PAGE
----------------------------------------------------------------------------------------------------------------------------------------------------------

<!DOCTYPE html>
<html>
<head>
<title>Check In</title>
<link href="/Content/themes/base/jqueryui?v=" rel="stylesheet"/>

<link href="/Content/kendo/2016.3.1118/kendoui?v=" rel="stylesheet"/>

<link href="/Content/pages/css?v=" rel="stylesheet"/>


<script type="text/javascript" src="/bundles/menuonly?v="></script>


<script> window["adrum-start-time"] = new Date().getTime();</script>
<script src="/KEN_adrum.js" type="text/javascript"></script>

</head>
<body>
<div class="page">
<div id="header">
<table style="width:100%; border-style:none; padding:0; margin:0" >
<tr>
<td style="border-style:none; padding:0; margin:0" >
<div style="padding:0; margin:0">
  • <a class="k-link" href="/WhereTo/WhereTo">Where To</a></li>
  • <span class="k-link">Parcel Processing<span class="k-icon k-i-arrow-s"></span></span><ul class="k-group k-menu-group">
  • <a class="k-link" href="/WhereTo/WhereTo">Where To</a></li>
  • <a class="k-link" href="/CheckIn/CheckIn">Check In</a></li>
  • <a class="k-link" href="/Dimensioning/Dimensioning">Inbound Dimensions</a></li>
  • <a class="k-link" href="/OpenBox/OpenBox">Open Box</a></li>
  • <a class="k-link" href="/Exceptions/Exceptions">Exception</a></li>
  • <a class="k-link" href="/Customs/Customs">Customs</a></li>
  • <a class="k-link" href="/ParcelContainer/CreateContainer">Container Management</a></li>
  • <a class="k-link" href="/AdvancedSearch/AdvancedSearch">Advanced Search</a></li>
</li>
  • <span class="k-link">Shipment Processing<span class="k-icon k-i-arrow-s"></span></span>
    • <a class="k-link" href="/Mawb/MawbToManifest">Finalize Shipment</a></li>
    • <a class="k-link" href="/Mawb/GetNewMawbs">View/Print MAWB</a></li>
    • <a class="k-link" href="/Mawb/GetMawbsForPost">Confirm MAWB</a></li>
    • <a class="k-link" href="/ParcelContainer/ReopenContainer">Reopen Container</a></li>
    </li>
  • <span class="k-link">Receiving<span class="k-icon k-i-arrow-s"></span></span>
    • <a class="k-link" href="/CarrierCheckin/CarrierCheckin">Carrier Checkin</a></li>
    • <a class="k-link" href="/CarrierCount/CarrierCount">Carrier Summary</a></li>
    </li>
  • <span class="k-link">Admin<span class="k-icon k-i-arrow-s"></span></span>
    • <a class="k-link" href="/OrderAdmin/OrderAdmin">Order Admin</a></li>
    • <a class="k-link" href="/ParcelAdmin/ParcelAdmin">Parcel Admin</a></li>
    • <a class="k-link" href="/ParcelLookup/ParcelLookup">Parcel History</a></li>
    • <a class="k-link" href="/Account/ChangePassword">Change Password</a></li>
    • <a class="k-link" href="/EventSummary/EventSummary">Event Summary</a></li>
    • <a class="k-link" href="/Location/LocationManager">Location Manager</a></li>
    • <a class="k-link" href="/LocationAdmin/LocationAdmin">Location Admin</a></li>
    </li></ul><script>
    jQuery(function(){jQuery("#Menu").kendoMenu({});});
    </script>
    </div>
    </td>
    <td width="10" style="white-space:nowrap; padding:0; margin:0">
    <div id="logindisplay">
    <strong></strong>
    Welcome <strong></strong>!
    [ <a href="/Account/LogOff">Log Off</a> ]

    </div>
    </td>
    </tr>
    </table>

    <input type="hidden" id="fromSubmit" value="0" />
    </div>
    <div id="main">

    <script type="text/javascript" src="/bundles/checkin?v="></script>

    <script type="text/javascript" src="/bundles/print?v="></script>

    <div id="content">


    <div class="container">
    <div class="row">
    <div class="cell" style="vertical-align:middle;"><h2>Check In</h2></div>
    <div class="cell" style="vertical-align:middle;">
    </div>
    </div>
    </div>

    <form action="/CheckIn/CheckIn" data-ajax="true" data-ajax-begin="ShowOverlay()" data-ajax-complete="HideOverlayData()" data-ajax-mode="replace" data-ajax-success="Redirect(data)" data-ajax-update="#content" id="form0" method="post"><div class="validation-summary-valid" data-valmsg-summary="true">
    • </li>
    </div> <div class="overlay">
    </div>
    <fieldset style="padding: 0px">
    <div style="visibility: hidden; height: 0px">
    <object id="BatchPrintProX1" codebase="/Content/Print/BatchPrintProX.cab" style="margin: 0px;
    width: 0px; height: 0px" classid="CLSID:36299202-09EF-4ABF-ADB9-47C599DBE778">
    <param name="_Version" value="65536" />
    <param name="_ExtentX" value="9260" />
    <param name="_ExtentY" value="1323" />
    <param name="_StockProps" value="0" />
    </object>

    <input type="hidden" id="ptrDocument" name="ptrDocument" value="Document Printer" />
    <input type="hidden" id="ptrBarcode" name="ptrBarcode" value="Barcode Printer" />
    <input type="hidden" id="ptrShipLabel" name="ptrShipLabel" value="Label Printer" />
    <input type="hidden" id="ptrTape1" name="ptrTape1" value="Tape Dispenser" />
    <input type="hidden" id="msgDocument" name="msgDocument" value="Do you have &quot;Document Printer&quot;?" />
    <input type="hidden" id="msgBarcode" name="msgBarcode" value="Do you have &quot;Barcode Printer&quot; configured for 2x4 labels?" />
    <input type="hidden" id="msgShipLabel" name="msgShipLabel" value="Do you have &quot;Label Printer&quot; configured for 4x6 labels?" />
    <input type="hidden" id="msgTape1" name="msgTape1" value="Do you have &quot;Tape Dispenser&quot; printer configured for round sticker?" />
    <input type="hidden" id="btnTape1Value" name="btnTape1Value" value="Dispense eBay sticker" />
    <input type="hidden" id="btnDGDocumentValue" name="btnDGDocumentValue" value="Reprint Dangerous Goods Document" />
    <input type="hidden" id="btnDGLabelValue" name="btnDGLabelValue" value="Reprint Dangerous Goods Label" />

    </div>

    <div style="padding: 20px">
    <div class="container">
    <div id="leftAlign" style="float: left;">
    <div class="rowMedium">
    </div>
    <p>
    </p>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_InboundTrackingNumber">Inbound Tracking ID</label>
    </div>
    <div class="focus cell">
    <input id="CheckInSearch_InboundTrackingNumber" name="CheckInSearch.InboundTrackingNumber" style="width:400px" type="text" value="" />
    <span class="field-validation-valid" data-valmsg-for="CheckInSearch.InboundTrackingNumber" data-valmsg-replace="true"></span>
    </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_CPORDNumber">CPORD Number</label>
    </div>
    <div class="focus cell">
    <input id="CheckInSearch_CPORDNumber" name="CheckInSearch.CPORDNumber" style="width:400px" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="CheckInSearch.CPORDNumber" data-valmsg-replace="true"></span> </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_SearchLicensePlate">License Plate</label>
    </div>
    <div class="focus cell">
    <input id="CheckInSearch_SearchLicensePlate" name="CheckInSearch.SearchLicensePlate" style="width:400px" type="text" value="" />
    <span class="field-validation-valid" data-valmsg-for="CheckInSearch.SearchLicensePlate" data-valmsg-replace="true"></span>
    </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_IsDamaged">Is Damaged</label>
    </div>
    <div class="editor-field cell">
    <input data-val="true" data-val-required="The Is Damaged field is required." id="CheckInSearch_IsDamaged" name="CheckInSearch.IsDamaged" type="checkbox" value="true" /><input name="CheckInSearch.IsDamaged" type="hidden" value="false" /> </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_Unidentified">Is Unidentifiable</label>
    </div>
    <div class="editor-field cell">
    <input data-val="true" data-val-required="The Is Unidentifiable field is required." id="CheckInSearch_Unidentified" name="CheckInSearch.Unidentified" type="checkbox" value="true" /><input name="CheckInSearch.Unidentified" type="hidden" value="false" /> </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="PIPInfoAggregate_NextRoutingDisposition_Description">Routing Disposition</label>
    </div>
    <div class="biglabel cell courier">

    <input id="PIPInfoAggregate_NextRoutingDisposition_Description" name="PIPInfoAggregate.NextRoutingDisposition.Description" type="hidden" value="" />
    </div>
    </div>
    </div>
    <div id="VerifyLP" class="hidden" style="font-size: 1.5em;" >
    Is there a License Plate already affixed to this parcel?
    </div>
    </div>
    <div class="biglabel message">

    </div>
    <div id="submitSection">
    <div>
    <input name="Command" type="submit" value="Search" />
    <input data-val="true" data-val-required="The CPORDRequired field is required." id="CPORDRequired" name="CPORDRequired" type="hidden" value="False" /> <input name="Command" type="submit" value="New" />
    </div>
    </div>
    </div>


    <script type="text/javascript">
    InitializeCheckInPage();
    </script>
    </fieldset>
    <script type="text/javascript">
    function HideOverlayData() {
    if ($('.overlay')) {
    $('.overlay').hide();
    }
    var bFound = false;
    if (document.forms[0] != undefined) {
    for (var i = 0; i < document.forms[0].elements.length; i++) {
    var t = i;
    if (document.forms[0][t].type != "hidden") {
    if (document.forms[0][t].disabled != true) {
    if (document.forms[0][t].type == "submit") {
    document.forms[0][t].focus();
    var bFound = true;
    }
    }
    }
    if (bFound == true)
    break;
    }
    }
    }
    </script>
    </form>
    </div>

    </div>
    <div id="footer">
    </div>
    </div>


    </body>
    </html>

    ------------------------------------------------------------------------------------------------------------------------------------------------------





    SECOND CONTENT PAGE
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    <script type="text/javascript" src="/bundles/checkin?v="></script>

    <script type="text/javascript" src="/bundles/print?v="></script>

    <div id="content">


    <div class="container">
    <div class="row">
    <div class="cell" style="vertical-align:middle;"><h2>Check In</h2></div>
    <div class="cell" style="vertical-align:middle;">
    <table style="border:none 0px;margin-left:200px;margin-right:3px;margin-top:3px;margin-bottom:3px;padding-left:3px;padding-right:3px;">
    <tr style="border:none 0px;color:black;">
    <td style="border:none 0px;font-size:1.5em;"><img alt= "ebay image" src= "../content/Images/ebay.jpg" style="height:40px;"/></td>
    </tr>
    </table>
    </div>
    </div>
    </div>

    <form action="/CheckIn/CheckIn" data-ajax="true" data-ajax-begin="ShowOverlay()" data-ajax-complete="HideOverlayData()" data-ajax-mode="replace" data-ajax-success="Redirect(data)" data-ajax-update="#content" id="form0" method="post"><div class="validation-summary-valid" data-valmsg-summary="true">
    • </li>
    </div> <div class="overlay">
    </div>
    <fieldset style="padding: 0px">
    <div style="visibility: hidden; height: 0px">
    <object id="BatchPrintProX1" codebase="/Content/Print/BatchPrintProX.cab" style="margin: 0px;
    width: 0px; height: 0px" classid="CLSID:36299202-09EF-4ABF-ADB9-47C599DBE778">
    <param name="_Version" value="65536" />
    <param name="_ExtentX" value="9260" />
    <param name="_ExtentY" value="1323" />
    <param name="_StockProps" value="0" />
    </object>

    <input type="hidden" id="ptrDocument" name="ptrDocument" value="Document Printer" />
    <input type="hidden" id="ptrBarcode" name="ptrBarcode" value="Barcode Printer" />
    <input type="hidden" id="ptrShipLabel" name="ptrShipLabel" value="Label Printer" />
    <input type="hidden" id="ptrTape1" name="ptrTape1" value="Tape Dispenser" />
    <input type="hidden" id="msgDocument" name="msgDocument" value="Do you have &quot;Document Printer&quot;?" />
    <input type="hidden" id="msgBarcode" name="msgBarcode" value="Do you have &quot;Barcode Printer&quot; configured for 2x4 labels?" />
    <input type="hidden" id="msgShipLabel" name="msgShipLabel" value="Do you have &quot;Label Printer&quot; configured for 4x6 labels?" />
    <input type="hidden" id="msgTape1" name="msgTape1" value="Do you have &quot;Tape Dispenser&quot; printer configured for round sticker?" />
    <input type="hidden" id="btnTape1Value" name="btnTape1Value" value="Dispense eBay sticker" />
    <input type="hidden" id="btnDGDocumentValue" name="btnDGDocumentValue" value="Reprint Dangerous Goods Document" />
    <input type="hidden" id="btnDGLabelValue" name="btnDGLabelValue" value="Reprint Dangerous Goods Label" />

    </div>

    <div style="padding: 20px">
    <div class="container">
    <div id="leftAlign" style="float: left;">
    <div class="licenseplatelabel cell" >
    LPKEN 00000 02142 28000
    <span class="field-validation-valid" data-valmsg-for="CheckInSearch.LicensePlate" data-valmsg-replace="true"></span>
    <input id="CheckInSearch_LicensePlate" name="CheckInSearch.LicensePlate" type="hidden" value="LPKEN000000214228000" />
    <input data-val="true" data-val-required="The ClearpathUpdatePermitted field is required." id="ClearpathUpdatePermitted" name="ClearpathUpdatePermitted" type="hidden" value="True" />
    </div>
    <div class="rowMedium">
    </div>
    <div class="rowMedium">
    </div>
    <p>
    </p>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_InboundTrackingNumber">Inbound Tracking ID</label>
    </div>
    <div class="biglabel cell">

    <input id="CheckInSearch_InboundTrackingNumber" name="CheckInSearch.InboundTrackingNumber" type="hidden" value="" />
    </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_CPORDNumber">CPORD Number</label>
    </div>
    <div class="focus cell">
    <div class="biglabel cell">
    OREUSA2318077683DE
    <input id="CheckInSearch_CPORDNumber" name="CheckInSearch.CPORDNumber" type="hidden" value="OREUSA2318077683DE" />
    </div>
    </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_IsDamaged">Is Damaged</label>
    </div>
    <div class="editor-field cell">
    <input type="checkbox" disabled="disabled" />
    <input data-val="true" data-val-required="The Is Damaged field is required." id="CheckInSearch_IsDamaged" name="CheckInSearch.IsDamaged" type="hidden" value="False" /> </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="CheckInSearch_Unidentified">Is Unidentifiable</label>
    </div>
    <div class="editor-field cell">
    <input type="checkbox" disabled="disabled" />
    <input data-val="true" data-val-required="The Is Unidentifiable field is required." id="CheckInSearch_Unidentified" name="CheckInSearch.Unidentified" type="hidden" value="False" /> </div>
    </div>
    <div class="row">
    <div class="biglabel cell">
    <label for="PIPInfoAggregate_NextRoutingDisposition_Description">Routing Disposition</label>
    </div>
    <div class="biglabel cell courier">
    OpenBox
    <input id="PIPInfoAggregate_NextRoutingDisposition_Description" name="PIPInfoAggregate.NextRoutingDisposition.Description" type="hidden" value="OpenBox" />
    </div>
    </div>
    </div>
    <div id="VerifyLP" class="hidden" style="font-size: 1.5em;" >
    Is there a License Plate already affixed to this parcel?
    </div>
    <div class="containerBorder">
    <div class="header">
    Ship To:
    </div>
    <div id="addressdata" style="float: left;">
    <div class="rowMedium">
    <div class="cellAddress">

    </div>
    </div>
    <div class="rowMedium">
    <div class="cellAddress">
    Steve  Doutheil
    </div>
    </div>
    <div class="rowMedium">
    <div class="cellAddress">
    Gartenstraße 6
    </div>
    </div>
    <div class="rowMedium">
    <div class="cellAddress">

    </div>
    </div>
    <div class="rowMedium">
    <div class="cellAddress">

    </div>
    </div>
    <div class="rowMedium">
    <div class="cellAddress">
    Berga    07980
    </div>
    </div>
    <div class="rowMedium">
    <div class="cellAddress">
    DE
    </div>
    </div>
    </div>
    </div>
    </div>
    <div class="biglabel message">

    </div>
    <div id="submitSection">
    <div>
    <input name="Command" type="submit" value="Dimension" />
    <input name="ReprintLicense" type="button" value="Reprint License" onclick="javascript:DownloadAndPrintLicense(
    'LPKEN000000214228000', true,
    false)" />
    <input name="Command" type="submit" value="Edit" />
    <input name="Command" type="submit" value="New" />
    <input name="Command" type="button" value="Traveler" onclick="OpenTraveler('LPKEN000000214228000')" />
    </div>
    </div>
    </div>


    <script type="text/javascript">
    InitializeCheckInPage();
    </script>
    </fieldset>
    <script type="text/javascript">
    function HideOverlayData() {
    if ($('.overlay')) {
    $('.overlay').hide();
    }
    var bFound = false;
    if (document.forms[0] != undefined) {
    for (var i = 0; i < document.forms[0].elements.length; i++) {
    var t = i;
    if (document.forms[0][t].type != "hidden") {
    if (document.forms[0][t].disabled != true) {
    if (document.forms[0][t].type == "submit") {
    document.forms[0][t].focus();
    var bFound = true;
    }
    }
    }
    if (bFound == true)
    break;
    }
    }
    }
    </script>
    </form>
    </div>





    **********************************************************************************************************************************************
  • Posted 15 Mar, 2017 17:48:21 Top
    Sergey Grischenko


    Add-in Express team


    Posts: 7233
    Joined: 2004-07-05
    Hi Georges,

    The IE object model doesn't provide such event. However you can use a timer in order to wait until the search content is ready. You can start the timer after you press Search and stop it when you find the search results. To get a HTML element by id you can use the 'ADXIEHelper.GetHTMLElementByID' method.
    Posted 16 Mar, 2017 12:40:30 Top
    Georges DEME




    Posts: 18
    Joined: 2017-03-07
    Thanks Sergey, is working perfect.

    Georges
    Posted 17 Mar, 2017 18:47:39 Top