ajax json error analysis

advertisements
json : {"status" : 0, "err_msg": "", "list":[{"id":100, "username":"la", num:"0100000"}]}

<script>
$.ajax({
type : "POST",
    url : "myAPI",
    data: "{ \"offset\" : 0, \"limit\" : 10 }",
    dataType : "json",
    success : function(json) {
    var message_list = json.list;
    var list_count = message_list.length;
    $.each(list_count, function() {
        var message_id = message_list.id;
        var message_username = message_list.username;
        var message_num = message_list.num;

        var html = "<tr>";
        html += "<td>"+message_id+"</td>";
        html += "<td>"+message_username+"</td>";
        html += "<td>"+message_num+"</td>";
        html += "</tr>";

        $("#tablebody").append(html);
        });
    },
    error: function() {
        alert("에러");
    }
});
</script>

please fix an error I want go success:(


The json should look like this:

{
    "status": 0,
    "err_msg": "",
    "list": [
        {
            "id": 100,
            "username": "la",
            "num": "0100000"
        }
    ]
}

Notice the num has also double quotes If you defined dataType json then you are waiting from server API a json type object if you get a parse error make sure you are getting an object json from API.

If the json returned is the one comming from server it should be a valid one.