Consider the following JavaScript AJAX request:
$.ajax({
type: "POST",
url: "/myurl",
async: false,
data: JSON.stringify({}),
contentType: "application/json",
complete: function (data) {
var results = data["responseText"];
alert(results)
},
error: function () {
alert("Error")
}
});
The JSON response received is as follows:
{"jsonrpc": "2.0", "id": null, "result": "{\"ids\": [{\"id\": 1, \"name\": \"Messi\"}, {\"id\": 2, \"name\": \"Ronaldo\"}]}"}
I want to display the data in a div as shown below. How can I achieve this?
1 Messi
2 Ronaldo