无法获取输出.返回代码206.缺少值

Not able to fetch output. Return code 206. Missing values.

本文关键字:代码 返回 获取 输出      更新时间:2023-09-26

请提供帮助。我使用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: JSON.stringify(data),替换data: data,