I am new to json and ajax this is my first example can any one help me out with this.
$.ajax({
type: "GET",
url: "ajs/index",
dataType: "JSON",
success: function(data) {
var obj = JSON.parse(data);
$("#result").html(obj.name);
}
});
The output of data is of the form:
[Object {id=10, name="ss", title="ss", content="h", ...}, Object {id=12, name="lo", title="gi", content="c", ...}, Object {id=13, name="lo", title="gi", content="c", ...}, Object {id=14, name="lo", title="gi", content="c", ...}, Object {id=15, name="n", title="m", content="m", ...}]
The output of obj(after parsing) is of the form:
[{"id":10,"name":"ss","title":"ss","content":"h","created_at":"2014-07-07T10:07:02.398Z","updated_at":"2014-07-07T10:07:02.398Z"}]{"id":12,"name":"lo","title":"gi","content":"c","created_at":"2014-07-08T05:26:05.816Z","updated_at":"2014-07-08T05:26:05.816Z"}
when i use obj.name it is nt displaying any data how can i display all my data.