Note that there are some explanatory texts on larger screens.

plurals
  1. POJS not recognizing a string from a hidden field?
    primarykey
    data
    text
    <p>I am trying to grab a string I'm reading in from an XML file to a JS function. For some reason the debugger in Chrome says the value in Glist is not a string.</p> <p>The code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head id="Head1" runat="server"&gt; &lt;%@ Page Language="C#" %&gt; &lt;title&gt;GAGEmobile&lt;/title&gt; &lt;link rel="stylesheet" href="/Content/MenuStyle.css" /&gt; &lt;script type="text/javascript" src="Scripts/jQuery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="Scripts/Scripts.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body id="generalBody" runat="server" dir="rtl"&gt; &lt;form runat="server" id="hidden"&gt; &lt;input type="hidden" runat="server" value='' id="Glist" /&gt; &lt;/form&gt; &lt;% var reader = new GAGEmobile.Models.ReadXML(); var data = reader.getDataFromXML("https://gagemobile- demo.servicebus.windows.net/gagemobile/gage/15/sample/david/blah"); this.Glist.Value = data; %&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { displayGageInfo(String("&lt;%: Glist.Value %&gt;")); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>the string in GList is:</p> <blockquote> <p>"Gage number|C-01001|Gage type|Caliper|Gage size|1 |Units of measure|Inches|Gage description|Digi inside w absolute encoder|Storage location|Tool Crib|Current location|Tool Crib|Status|Available|Owner|Company|Group|Calib Group|EmailTo|Bobby Mohr|Last calib date|3/28/2013|Calib due date|9/28/2013|Last RR date|9/5/2012|RR due date|9/5/2013|Last maintenance date|2/27/2013|Maintenance due date|2/27/2015|Manufacturer|Fowler|Model number|FIC-23451|Serial number|18732|Comment|CALIBRATION GROUP EXPLANATION<br> We defined the Calibration Group as a set of gages that will be calibrated all at the same time. We set this value using the Group field above. This allows us to easily filter for these gages and gather them for calibration. SCHEDMAINTDUE EXPLANATION We have also used the user defined fields to create a new field called SchedMaintDue. This field allows us to define a Scheduled Maintenance Due Date for easy access to filtering and reference of maintenance cycles on our gages."</p> </blockquote> <p>While I have the string in the server code everything is fine. It's when I pass to JS something goes wrong and I have no idea why.</p> <p>I've tried using the escape() and toString() functions in JS.</p> <p>Edit: The error occurs at 'displayGageInfo(String("&lt;%: Glist.Value %>"));' as an unrecognized token</p> <p>The ASP.NET that reads the XML:</p> <pre><code>public string getDataFromXML(string url) { var xml = new XmlDocument(); xml.Load(url); return xml.InnerText; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload