Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jSignature + asp.net Best Practice? #22

Open
jagilbert opened this issue Mar 4, 2013 · 1 comment
Open

jSignature + asp.net Best Practice? #22

jagilbert opened this issue Mar 4, 2013 · 1 comment

Comments

@jagilbert
Copy link

Is there a "best" way to getData() from the client to the server in asp.net. I've seen references to using json or putting data in a hidden field. I'd like to use a tried and true method instead of reinventing it myself.

Cheers,
Jeff

@Gfweis
Copy link

Gfweis commented Jun 29, 2013

I use webservices. Something like...

// Accept Signature /////////////////////////////////////////////////////////////////////////////////
var baseUrl = RootUrl + "WebServices/Pt.asmx/";

function SignatureAccept() {
var $cbs = $('input[name="ToDeliver"]'); // This is series of Checkboxes
var Keys = '';
$cbs.each(function () { if (this.checked) Keys += this.value + "~"; });
var Signature = $("#divSignature").jSignature("getData", "base30");
var Notes = $('#deliveryNotes').val();
var Confirm = ($("#deliveryConfirmation").val() === '1');
var jsonData = JSON.stringify({ "Token": Token, "SignatureType": Signature[0], "SignatureData": Signature[1], "Keys": Keys, "Notes": Notes, "Confirm": Confirm });
$.ajax({
url: baseUrl + "DeliverE",
data: jsonData,
success: function (data) {
if (data.d.Success) { // Variable passed back from webservice
$("#divShowPackages").hide(); // hide a few items
$("#divGetSignature").hide();
$("#divFindResident").show(); // screen that we want to show
$("#divSignature").replaceWith(divCloneSignature); // Copy of the div before drawing signature
Clear(); // Clears some of our variables
var Keys = '';
SoundComplete(); // Beeps on success
}
MessagesShow(data.d.Message); // Our message handler
}
});
}

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants