本文介绍了如何在Jquery中提取字典Json值,如2DArray?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码,其中我从服务器方法获取字典数据的形式为







{Peter Pan:peterpan@pan.de,Molly:molly@yahoo.com,Don Corleone:don@vegas.com}



代码:

$ .ajax({

类型:POST,

url: Default.aspx / GetPeople,

contentType:application / json; charset = utf-8,

dataType:json,

成功:功能(结果){

var Mydata = result.d;

$(#dictionary)。append(Mydata);

}

});

});

});



如何在jquery中使用.each()函数帮助在html Div中以2DArray格式显示它们。

请回答@@

解决方案
.ajax({

类型:POST,

url:Default.aspx / GetPeople,

contentType:application / JSON; charset = utf-8,

dataType:json,

成功:函数(结果){

var Mydata = result.d ;


(#dictionary)。append(Mydata);

}

});

});

});



如何在html Div中以2DArray格式显示它们jquery中.each()函数的帮助。

请回答@@


你可以这样做:



 


here is my code in which I am getting data of dictionary from a server method in the form of



{"Peter Pan":"peterpan@pan.de","Molly":"molly@yahoo.com","Don Corleone":"don@vegas.com"}

code:
$.ajax({
type: "POST",
url: "Default.aspx/GetPeople",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
var Mydata = result.d;
$("#dictionary").append(Mydata);
}
});
});
});

how can I show them in a 2DArray format in html Div with the help of .each() function in jquery.
Please Answer@@

解决方案
.ajax({
type: "POST",
url: "Default.aspx/GetPeople",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
var Mydata = result.d;


("#dictionary").append(Mydata);
}
});
});
});

how can I show them in a 2DArray format in html Div with the help of .each() function in jquery.
Please Answer@@


You can do like this:


这篇关于如何在Jquery中提取字典Json值,如2DArray?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 08:09