Hi,
I am trying to save Base64 data in to database.
But I am not able to send dataUrl to my .asmx file.
--------------------------------------------------------------------------
Jquery
======
function UploadUserPhoto() {
var Mycanvas = document.getElementById("tempCanvas");
var dataURL = Mycanvas.toDataURL("image/png");
$.ajax({
url: "LP18WS.asmx/UploadPhoto",
contentType: "application/json; charset=utf-8",
data: {
Base64String: "\'" + dataURL + "\'"
},
dataType: "json",
success: function (msg) {
alert(msg.d);
},
error: function (msg) {
alert(msg + '\n' + xhr.responseText);
},
});
}
Webservice(LP18WS.asmx)
======================
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public string UploadPhoto(string Base64String)
{
string message = "";
//code to save data url in database
return message;
}
=============================
But it is not sending the dataurl. If I put some other string instead of dataurl it is working.
Why this dataurl can't send?. Can any one guid me?