gpt4 book ai didi

javascript - JS解析ShowOpenDialog结果集

转载 作者:行者123 更新时间:2023-12-03 12:21:21 27 4
gpt4 key购买 nike

在针对 ShowOpenDialg 方法的 Javascript 中,我收到以下响应:

"{"items":[{"id":"{168B874F-9CF7-E311-B136-00155D02101E}","name":"Test Account1 -     6/19/2014","html":"<nobr title=\"Test Account1 - 6/19/2014\" class=\"gridcellpadding\"><a  href=\"#\" id=\"gridBodyTable_primaryField_{168B874F-9CF7-E311-B136-00155D02101E}_0\"  target=\"_self\" title=\"Test Account1 - 6/19/2014\" class=\"ms-crm-List-Link\"  tabindex=\"6\">Test Account1 - 6/19/2014</a></nobr>","type":"1","values":" [{\"name\":\"name\",\"value\":\"Test Account1 - 6/19/2014\"}, {\"name\":\"accountnumber\",\"value\":\"\"},{\"name\":\"primarycontactid\",\"value\":\"\"}, {\"name\":\"address1_city\",\"value\":\"\"},{\"name\":\"telephone1\",\"value\":\"\"}, {\"name\":\"emailaddress1\",\"value\":\"\"},{\"name\":\"fax\",\"value\":\"\"}, {\"name\":\"address1_name\",\"value\":\"\"}, {\"name\":\"address1_fax\",\"value\":\"\"}]","keyValues":"{\"name\": {\"name\":\"name\",\"value\":\"Test Account1 - 6/19/2014\"},\"accountnumber\": {\"name\":\"accountnumber\",\"value\":\"\"},\"primarycontactid\": {\"name\":\"primarycontactid\",\"value\":\"\"},\"address1_city\": {\"name\":\"address1_city\",\"value\":\"\"},\"telephone1\": {\"name\":\"telephone1\",\"value\":\"\"},\"emailaddress1\": {\"name\":\"emailaddress1\",\"value\":\"\"},\"fax\": {\"name\":\"fax\",\"value\":\"\"},\"address1_name\": {\"name\":\"address1_name\",\"value\":\"\"},\"address1_fax\": {\"name\":\"address1_fax\",\"value\":\"\"}}","category":null,"ambiguousRecordsXml":null,"sel ected":false,"displayclass":"","onclick":"openlui(new Sys.UI.DomEvent(event));"}]}"

我需要在响应的第一行中检索idname

如何在 JS 中做到这一点?检索方法应该是通用的,因为响应可能包含多个记录。这是单条记录的数据。

谢谢。

最佳答案

我设法提取值(value)如下:

obj = JSON.parse(dlgReturnValue); //dlgReturnValue is JSON object holds the result
var id = obj.items[0].id;
var name = obj.items[0].name;

关于javascript - JS解析ShowOpenDialog结果集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24429736/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com