Hi im retrieving some data from a database using JSON and ajax. When i grab the information i need i would like it to be displayed on a new line in the div im putting it in.
At the minute the postcodes just overwrite eachother.
$.ajax({
url: 'process.php',
type: 'GET',
data: 'address='+ criterion,
dataType: 'json',
success: function(data)
{
jQuery.each(data, function()
{
$('#carParkResults').html("Postcode " + data[count].postcode);
codeAddress(data[count].postcode);
alert(count);
count++;
});
},
error: function(e)
{
//called when there is an error
console.log(e.message);
alert("error");
}
});
Use append / appendTo to add elements to a DOM element, without overwriting the existing children of the element.