简体   繁体   中英

javascript call web api from remote server

I have this code

but it run on localhost successfully but when I tried it on remote it refused

    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
    });

it go to error function every time

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM