I want to load json information from another page in my site with ajax. here is what i have so far
$(function() {
$('#show-more').bind('click', function() {
$.ajax({
url: 'http://localhost:3000/users/10',
dataType: 'json',
success: function(data) {
alert(data);
}
});
});
})
When I do this, the alert popups up and I get [OBJECT OBJECT] [OBJECT OBJECT]. How can I take this data and append it to my feed id on the page. I tried this in place of alert(data):
$('#feed').append(data);
However I get this error "fragment.appendChild( ret[i] ); " in my console. How can I do what I want properly?
Also, there is a field in the data i am retrieving titled message that I am trying to access. How could I access it? Would i do something like data.message?
Thanks in advance!