我在C#asp .net页面中有一个简单的js代码,旨在获取签名并将其数据发送到数据库中。
var canvas = document.getElementById("signature");
var w = window.innerWidth;
var h = window.innerHeight;
// Spec canvas dimensions
canvas.width = 700;
canvas.height = h / 2.5;
var signaturePad = new SignaturePad(canvas, {
dotSize: 1
});
document.getElementById("save").addEventListener("click", function (e) {
if (!signaturePad.isEmpty()) {
// Gets img data and split it to server
var imageURI = signaturePad.toDataURL();
var encoded_image = imageURI.split(',');
var img_to_server = encoded_image[1];
$.ajax({
url: "About.aspx/",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
type: "POST",
dataType: "text",
data: { image: img_to_server },
success: function (msg) {
window.alert('success');
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
window.alert('no success');
}
});
}
}, false);
该页面正确加载,并且我将POST请求发送到应用程序的另一页面:About.aspx 在该页面上,我想获取发送的值以在查询中使用它,但是我找不到将其存储在变量中的方法
public partial class About : Page
{
protected void Page_Load(object sender, EventArgs e)
{
Debug.WriteLine("Inside");
string val = Request.Params["image"];
Debug.WriteLine(val);
}
}
我在这里想念什么?
答案 0 :(得分:0)
通过:检索上传的文件
invalid argument