gpt4 book ai didi

javascript - 无法获取输出。返回代码 206。缺少值。

转载 作者:行者123 更新时间:2023-12-03 10:32:43 25 4
gpt4 key购买 nike

请帮忙。我正在使用 ajax 同步调用远程服务器。错误与异步调用相同。

function create_vswitch(endpoint,data){
var response=send_recieve(endpoint,data);
console.log(response.params.id);
return response.params.id;
}
function configure_server_vswitch(endpoint,data){
var response=send_recieve(endpoint,data);
console.log(JSON.stringify(response));


function send_recieve(endpoint,data){
var url=http://10.77.94.243/830a341f-5249-4704-bd49-a732063a7dcb + endpoint
console.log(url);
var response="";
$.ajax({
url: url,
type: "POST",
dataType:"json",
data: data,
contentType:"application/json",
success:function(){console.log("success")},
error:function(){console.log("ERROR")},
async:false
}).then(function(response){
resp=response;
});
return resp

$("#create").click(function() {
var COMPUTE_VSWITCH_UUID=create_vswitch("/qvbn-switch-agent/compute.vswitch",{"name":"compute_vswitch_test102"});
console.log(COMPUTE_VSWITCH_UUID);
//var compute_server_uuid=
configure_server_vswitch("/qvbn-switch-agent/compute.server",{"configuration":{"tid":"compute.vswitch","id":COMPUTE_VSWITCH_UUID}});
});

我得到的控制台输出是:

http://10.77.94.243:8280/830a341f-5249-4704-bd49-a732063a7dcb/qvbn-switch-agent/compute.vswitch
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
Done
739d4940-b12d-4a6c-8ba6-fad7d30ce78f
739d4940-b12d-4a6c-8ba6-fad7d30ce78f
http://10.77.94.243:8280/830a341f-5249-4704-bd49-a732063a7dcb/qvbn-switch-agent/compute.server
Done
{"code":206,"cid":"qvbb","reason":"missing values for attributes configuration","params":null,"result":false,"error":true}

正如您所看到的最后一个 o/t,它表示“属性配置缺失值”。我无法理解这段代码有什么问题。有人可以告诉我这段代码有什么问题吗?

最佳答案

尝试将 data: data, 替换为 data: JSON.stringify(data),

关于javascript - 无法获取输出。返回代码 206。缺少值。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29139290/

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