Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few possibilities:</p> <ul> <li><p><code>mydata</code> may not actually be a local in the view.</p> <p>Express can't pass along the name of the variable used as the argument. Only the properties of the <code>Object</code> it references.</p> <p>So, you may need to create a new <code>Object</code> around <code>mydata</code> to name a property for it:</p> <pre><code>render('/abc', { mydata: mydata }); </code></pre></li> <li><p>The output may be HTML-encoded by <code>{{= }}</code>, which will likely cause SyntaxErrors in JavaScript.</p> <p>So, the response may contain something like:</p> <pre><code>xyz({&amp;quot;foo&amp;quot;:&amp;quot;bar&amp;quot;}) </code></pre> <p>Rather than:</p> <pre><code>xyz({"foo":"bar"}) </code></pre> <p>How to go about skipping HTML-encoding will depend on which view engine you're using with Express. But, it may be as simple as replacing the <code>=</code> with a <code>-</code>:</p> <pre><code>xyz({{-mydata}}) </code></pre></li> <li><p><code>mydata</code> may still be an <code>Object</code> rather than the <code>String</code> of <code>json_encoded</code> data it seems you were expecting.</p> <p>If that's the case, it may be using the <a href="http://es5.github.io/#x15.2.4.2" rel="nofollow">standard <code>.toString()</code></a>, which will produce:</p> <pre><code>xyz([object Object]) </code></pre> <p>And, you may still need to <code>stringify()</code> <code>mydata</code>.</p> <pre><code>xyz({{-JSON.stringify(mydata)}}) </code></pre></li> </ul>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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