本文介绍了如何使用Javascript / jQuery将逗号分隔列表转换为json?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HEllo团队,



这是我写的代码。

HEllo team,

This the Code which i Wrote .

$('#batchIDSelect').val()
["1", "2"]
$('#batchIDSelect').text()
"

                        12"
qcAllocationDetails
Object {BatchId: Array[2], FromDEOUserId: "1", ToDEOUserId: 0, State: "", FromDate: "01-01-2014"…}
AllocationCount: 0
BatchId: Array[2]
CreatedBy: 0
CreatedOn: null
DEOStatus: "0"
Deleted: 0
Error: null
ExistingCount: 0
FromDEOUserId: "1"
FromDate: "01-01-2014"
FromQCUserId: 0
IsValid: false
Key: 0
QCStatus: 0
State: ""
ToDEOUserId: 0
ToDate: "21-04-2014"
ToQCUserId: undefined
UpdatedBy: 0
UpdatedOn: null





在BatchId中,我得到的值如下:

BatchId:Array [2]

我选择BatchId使用Multi Select文本框For BatchID,I希望输出像

[1,2]。我想传递String.How有可能吗?



谢谢

Harshal



In BatchId i am getting the value as below:
BatchId: Array[2]
I use Multi Select textbox For BatchID when i select the BatchId ,I want the output like
["1", "2"]. I want to pass in String.How is it possible?

Thanks
Harshal

推荐答案






在BatchId中,我得到的值如下:

BatchId:Array [2]

我使用Multi Select文本框对于BatchID,当我选择BatchId时,我希望输出像

[1, 2\" ]。我想通过String.How有可能吗?



谢谢

Harshal



In BatchId i am getting the value as below:
BatchId: Array[2]
I use Multi Select textbox For BatchID when i select the BatchId ,I want the output like
["1", "2"]. I want to pass in String.How is it possible?

Thanks
Harshal


var jsonString = JSON.stringify(foo);



[]


这篇关于如何使用Javascript / jQuery将逗号分隔列表转换为json?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 15:16