如何在Jquery中提取字典Json值,如2DArray?

人气:124 发布:2022-09-22 标签: javascript json c#

问题描述

这是我的代码,其中我从服务器方法获取字典数据的形式为 {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:

565