@{
ViewData["Title"] = "Signature";
}
<h3>Sign here</h3>
<div class="frame">
<ej-signature id="mysign" height="400px" width="500" stroke-width="3" is-responsive="true" />
<input id="btnUpload" type="button" value="UploaddatatoDB" onclick="Uploaddata()" />
</div>
<script>
function Uploaddata() {
var target1 = $("#mysign").ejSignature("instance")._canvas[0].toDataURL()
var div = $("#mysign");
var canvas = div["children"]()[0];
image = canvas.toDataURL("image/png");
newimage = image.replace('data:image/png;base64,', '');
$.ajax({
type: 'POST',
url: '@Url.Action("Upload", "Home")',
data: {
target: newimage
},
success: function (data) {
alert("success" );
}
});
}
</script>
|
public class SignatureTask
{
public string DataValue { get; set; }
public string SaveValueObject { get; set; }
} |
[HttpPost]
public IActionResult Upload(string target)
{
SignatureTask obj = new SignatureTask();
// Saving the signature value in model object
obj.SaveValueObject = target;
return View();
} |