gpt4 book ai didi

javascript - 无法在json数据中动态传递数据

转载 作者:行者123 更新时间:2023-11-29 21:01:32 26 4
gpt4 key购买 nike

var updFileId = "12345";

$scope.compGridJson = {
"peers": ["localhost:7051", "localhost:8051"],
"fcn": "move",
"args": ["compGridDetails", "{" +
"\"FromParty\":\"Valuelabs\",\"CreatedState\":\"24/08/2017\",\"FileUId\":\"+updFileId+\",\"Status\":\"ValueLabs Change Request\"}"
]
}
$http({
method: "POST",
url: "http://localhost:4000/channels/mychannel/chaincodes/changedneww727",
data: $scope.compGridJson,
headers: {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
}
}).success(function(data, status, headers, config) {

}).error(function(data, status, headers, config) {

});

上面是我的代码。在“FileUId”的 Json 数据中,我动态传递数据。但它不是动态获取数据。我为该值更改了很多方法,但它并没有动态获取。我想动态传递“12345”值。有人可以帮助我吗?

最佳答案

您的字符串连接格式不正确。你应该尝试:

$scope.compGridJson = {
"peers": ["localhost:7051", "localhost:8051"],
"fcn": "move",
"args": ["compGridDetails", "{" +
"\"FromParty\":\"Valuelabs\",\"CreatedState\":\"24/08/2017\",\"FileUId\":\""+updFileId+"\",\"Status\":\"ValueLabs Change Request\"}"
]
}

关于javascript - 无法在json数据中动态传递数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46195868/

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