issue with handling json data from server
<p>i have an problem with handling data come from server , please see the code bellow :</p>

<p>php</p>

<pre><code>echo json_encode(array("toshow"=&gt;"&lt;span class='text'&gt;&lt;img src='greencheck.png'/&gt;"));
</code></pre>

<p>javascript </p>

<pre><code>$('#data').ajaxForm({
                dataType: 'json',
                success: function(data){
                    if(data.error == 1){
                        $('#preview').html("&lt;span class='text'&gt;&lt;img src='close.png'/&gt;"+data.filename+" File exsist ..&lt;/span&gt;");
                    }else{

                         $('.first').after(data.toshow);
                    }
                }
                }).submit();
</code></pre>

<p>problem is when i send data from the server as {'data'=>someData} , i have no problem .. when i send any html tags such as <code>{'data'=&gt;"&lt;span&gt;some data&lt;/span&gt;"}</code> success function in javascript is not processing anything so success = fails ..   </p>

<p>case 1 : sending json data from the server example , {'error'=>1,'msg'=>file exists} , in this case every thing is ok .
<img src="http://i.stack.imgur.com/LssRX.jpg" alt="enter image description here"></p>

<p>case 2 : sending json data from the server example ,{'toshow'=>linkdatta...etc} , so in case of adding any html tag in json problem start so success function not working at all </p>

<p><img src="http://i.stack.imgur.com/qZWCi.jpg" alt="enter image description here"> </p>
