1
I have a function more or less like this:
$('#btn-load-more').click(function(){
    var key = $('#hash').val(), limit = 0, i = 0;
    setTimeout(function(){
        $.post('api', {type: 1, limit: limit, key: 128921}, function(res){
            console.log(res);
        });
    }, 500);
});
But the problem is that by clicking the button and triggering the event, the result on the console is exactly like this:
[{"title":"Título de teste","thumb":"2","views":"920134"},{"title":"lorem 
ipsum teste inskl","thumb":"2","views":"920134"}]
When the result should be several objects. As in the example below:
(2) [Object, Object]
    ▼ 0: Object
        thumb: "2"
        title: "Título de teste"
        views: "920134"
    ▶ 1: Object
But my goal was to return an object, as happens when I change the $.post for $.getJSON, what I’m doing wrong?
Set the fourth parameter of
$.postas"json". By default, he isstring, so its result is not converted to object. Just read the documentation.– Woss
Thanks man, wow! such an easy problem!
– Anderson Santos