27 lines
802 B
Plaintext
27 lines
802 B
Plaintext
|
|
@{
|
|||
|
|
ViewData["Title"] = "test";
|
|||
|
|
}
|
|||
|
|
<h1>@ViewData["Title"]</h1>
|
|||
|
|
|
|||
|
|
<button id="click">测试ajax</button>
|
|||
|
|
@section Scripts{
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
$("#click").on("click",function(){
|
|||
|
|
var postdata = {"id":"08d9f761-b402-47f0-8656-0e529a9b5b8b"};
|
|||
|
|
$.ajax({
|
|||
|
|
url:"https://localhost:44335/ybapi/fans/getinfo",
|
|||
|
|
method:"post",
|
|||
|
|
xhrFields: {
|
|||
|
|
withCredentials: false // 如果是https请求,可以试试 true
|
|||
|
|
},
|
|||
|
|
crossDomain: true,
|
|||
|
|
contentType:"application/json",
|
|||
|
|
data:JSON.stringify(postdata),
|
|||
|
|
success:function(res){
|
|||
|
|
console.log(res);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
}
|