Javascript error while executing alert function through php
<p>I am using fusion maps in one of my application.</p>

<p>In one of the example i have to pass the value from one map to another charts,</p>

<p>I am facing one problem if the data passed is numeric its displaying alert message correctly but if it is a string it generates an error:</p>

<pre><code>NM is not defined
</code></pre>

<p>javascript:alert(NM)()</p>

<p>My code is as below:</p>

<pre><code>$strXML .= "&lt;entity id='" . $rs1['Internal_Id'] . "' value='" . round((($rs1['datap'] /  $sumdata) * 100),2) . "' link='javascript:alert(".($rs1['Internal_Id']) . ")'  /&gt;";
</code></pre>

<p>If i change the link part (passing single quotes in alert)that is:</p>

<pre><code>$strXML .= "&lt;entity id='" . $rs1['Internal_Id'] . "' value='" . round((($rs1['datap'] /  $sumdata) * 100),2) . "' link='javascript:alert('".($rs1['Internal_Id']) . "')'  /&gt;";
</code></pre>

<p>It displays invalid xml data.</p>

<p>Please help me on this</p>

<p>Thanks</p>

<p>Pankaj</p>
