javascript从远程服务器调用webapi

javascript call web api from remote server

本文关键字:调用 webapi 服务器 javascript      更新时间:2023-09-26

我有这个代码

但它在本地主机上成功运行,但当我在远程尝试时,它拒绝了

    var parameters = { domainGuid:"test1",type:"testtype"    };
    var url = "http://remote_server/api/controller_name/test_api";
 //   jQuery.support.cors = true;
    $.ajax({
        url: url,
        type: 'POST',
        data: parameters,
        async: false,
        dataType: "json",
        crossDomain: true,
        success: get_all_videos_success,
        error: get_all_videos_error
    });

每次

时,它都会进入错误功能

您是否尝试过将dataType从json切换到jsonp?