When I have one result from ajax.php I get correct result, but if I have two or more result I can't see result
<script type="text/javascript">
$(document).ready(function() {
$('#txt').bind('propertychange keyup input paste',function() {
$('div#text-container').html('');
var word = $('input#txt').val();
$.ajax({
type: 'GET',
url: 'ajax.php',
data: { word: word },
dataType: 'json',
success: function (data) {
if (data.text) {
var result = "<strong>" + data.word + '</strong> - ' + data.text
} else {
var result = "<strong>" + data.word + '</strong> - ' + "not found"
}
$('div#text-container').append(result);
}
});
});
});
</script>
result example(Coming from ajax):
[{
"word": "Hell",
"text": "Hell"
}, {
"word": "Hello",
"text": "Hello"
}]
How can I solve this problem?
Thanks!