我有以下ajax调用来调用webservice并检索回json数据
$(document).ready(function () {
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: "Test.asmx/GetImages",
success: function (msg) {
//var data = JSON.parse(msg);
alert(msg.d);
$.each(msg.results, function (i, tweet) {
alert(msg.d);
$("#imagelist").append('<p><img src="' + tweet + '" />' + tweet + '</p>');
});
}
});
});
我有从ajax调用获得的json结果,我发现难以附加img源。
{"d":"[\r\n {\r\n \"imagepath\": \"images/01.jpg\"\r\n },\r\n {\r\n \"imagepath\": \"images/02.jpg\"\r\n },\r\n {\r\n \"imagepath\": \"images/03.jpg\"\r\n },\r\n {\r\n \"imagepath\": \"images/04.jpg\"\r\n }\r\n]"}