The following ajax call gives the following result:
    $.ajax({
        type: "POST",
        url:  //**My full URL goes here**,
        data: {sources: sources},
        dataType: "json",
        success: function(data) {
            alert(data);
            alert(data.length);
            for (var i = 0; i < data.length; i++)
            {
                alert(data[i]);
            }
        }
    });
Result:
data:
[objject object],[objject object],[objject object]
length:
3
in loop:
[objject object]
[objject object]
[objject object]
and the following code , in which I just added:
var data = $.parseJSON(data);
$.ajax({
    type: "POST",
    url:  //**My full URL goes here**,
    data: {sources: sources},
    dataType: "json",
    success: function(data) {
        var data = $.parseJSON(data);
        alert(data);
        alert(data.length);
        for (var i = 0; i < data.length; i++)
        {
            alert(data[i]);
        }
    }
});
The above code gives me the following error:
Uncaught Syntax Error: Unexpected token o
Why is that? Am I doing something wrong? How can I fix it?
 
     
    