0
对不起,我的英语JSON发送到另一台服务器。使用asp.net mvc的核心C#
我需要JSON发送到另一台服务器。
例子:127.0.0.1/api/start
在这个其他的服务器我有我创建运行服务,服务需要得到一个JSON
示例{“SERVERID”:“1” “ServerPort”: “27015”}
我怎样才能做到这一点?
我知道用jQuery发送JSON,但我想知道如何不使用jQuery做到这一点使用asp.net核心。有可能吗?
public IActionResult Start()
{
// Code here
return View();
}
我需要使用asp.net核心做这个代码
var arr = { ServerId : '1', ServerPort : '27015'};
console.log(JSON.stringify(arr));
return jQuery.ajax({
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
'type': 'POST',
'url': '13.77.102.81/Api/MTA/Start',
'data': JSON.stringify(arr),
'dataType': 'json',
'success': function (msg) {
console.log(msg);
}
});
HM ..但IP,我需要发送JSON是13.77.102.81,不要暴露你的IP这里我具体该? –
更准确的说是要送13.77.102.81/api/mta/start –
或您的服务发送GET请求?有两件事 –