I don't know if this is an issue with JavaScript, jQuery, or JSON, but when I use spaces in any of my Data Entries (see var title1 below) then everything after the space is omitted. Perhaps the data has to be encoded in a certain way? I tried using & nbsp ; instead of actual spaces without luck.
For the sake of simplicity I tried to remove any code no relevant to this issue.
html\javascript:
<div id="verification"></div>
<script>
function update() {
$.ajax({
url: 'update.php', //php
data: "",
dataType: 'json',
success: function (data) {
//on receive of reply
var title1 = data[2];
$('#verification').html("<img src=images/data-image.gif title="+title1+"></img>"); //output to html
}
});
}
</script>
json response
["this is a really long test that has 123 numbers and letters. * . test"]
output (by Mouseover text with Title)
this
*****php******
$result = mysql_query("SELECT title1 FROM users WHERE username = '$foobar'")
or die(mysql_error());
$array = mysql_fetch_row($result);
echo json_encode($array);