Question: I'm trying to display image in HTML from MySql and PHP.

My ajax request

```
$.ajax({
    type : "POST",      
    url : "jsonajax.php",
    data : { id: id },
    success : function(data){
        alert(data);
        $('#dialog').dialog('open');
        $('#dialog').html('<img src='+ data + '" />');
    }
});

```

My jsonajax.php

```
$id = $_REQUEST['id'];
$sql = "SELECT img_url FROM table_name WHERE id = $id";
$res=$obj->_executeQuery($sql);
$res=$obj->getAll($res);
echo json_encode($res);

```

Now the `alert(data)` looks like

```
[{"img_url":"images\/Jellyfish.jpg"}]

```

I need to remove '\' and append the image src to display.

Answer: 
You need to add a datatype, like "Json"
Add `dataType:"json"` 

```
$.ajax({
  type : "POST",
  dataType: "json",      
  url : "jsonajax.php",
  data : { id: id },
  success : function(data){
      alert(data);
      $('#dialog').dialog('open');
      $('#dialog').html('<img src='+ data + '" />');
  } 
});

```

And then do `data.img_url`