使用以下脚本,我试图访问使用ajax函数中的数据发送的变量,但我不能.
<script>
$('#inline-username').click(function () {
var comments = $('#inline-username').val();
//var selectedId = $('#hdnSelectedId').val();
$.ajax({
url: '@Url.Action("UpdateOrder")', // to get the right path to controller from TableRoutes of Asp.Net MVC
dataType: "json", //to work with json format
type: "POST", //to do a post request
contentType: 'application/json; charset=utf-8', //define a contentType of your request
cache: false, //avoid caching results
data: { test: $(this).text() }, // here you can pass arguments to your request if you need
success: function (data) {
// data …Run Code Online (Sandbox Code Playgroud) 我正在使用 API 开发一个项目。现在我正在尝试加密数据,这样就没有人可以编辑它。我想到使用公钥来加密数据,并使用私钥来加密公钥和(加密数据)。但我无法使用 API uri 发送此加密数据,因为它包含“/”字符。
加密 JSON 数据以便无人可以编辑的最佳方法是什么?
这是 Json 的示例:
{
"Name": "HP Laptop",
"Category": "Laptop",
"Price": 300,
"Currency": "OMR",
"details": "core i 5 ",
"productID": 1,
"Quantity": 10
}
Run Code Online (Sandbox Code Playgroud)