i have an problem with handling data come from server , please see the code bellow :
php
echo json_encode(array("toshow"=>"<span class='text'><img src='greencheck.png'/>"));
javascript
$('#data').ajaxForm({
dataType: 'json',
success: function(data){
if(data.error == 1){
$('#preview').html("<span class='text'><img src='close.png'/>"+data.filename+" File exsist ..</span>");
}else{
$('.first').after(data.toshow);
}
}
}).submit();
problem is when i send data from the server as {‘data’=>someData} , i have no problem .. when i send any html tags such as {'data'=>"<span>some data</span>"} success function in javascript is not processing anything so success = fails ..
case 1 : sending json data from the server example , {‘error’=>1,’msg’=>file exists} , in this case every thing is ok .

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
In your php file set content-type to json: