以下AJAX调用正在调用需要对象的API端点。目前,当我放置断点时,端点没有受到攻击。但是,在AJAX中,我分别发送了三个变量(它们也在Foo对象中)。
如何将这三个字符串作为一个端点发送给API端点?
AJAX通话:
var Foo = { "EntityId": entityId, "PageName": pageName, "PropertyName" : propertyName};
const getFoo = $.ajax({
url: "/Api/Foo/GetData",
type: "POST",
contentType: "application/json",
data: Foo
});
getFoo
.done((data: IApiResponse<ApiFoo>) => {
$("#foo-modal-text").text(data.data.text);
})
.fail((xhr) => {
});
API端点:
[Route("GetData")]
[HttpPost]
public async Task<ActionResult<ApiResponse<Foo>>> GetData([FromBody] Foo foo)
{
var data = await _fooService.FindAsync(tt =>
tt.EntityId == tooltip.EntityId &&
tt.PageName == tooltip.PageName &&
tt.PropertyName == tooltip.
foo.Text = data.
return new OkObjectResult(new ApiResponse<Foo>(foo));
}