This is not a new idea in programming but I really need help on how to do it correctly. I am trying to send 2 variables in a JSON call to a web method.
$("#btn1").click(function () {
getEventL($(this).find(1).val(), "a");
});
function getEventLetter(v1, v2) {
var nEvent = { var1: v1, var2: v2 };
$.ajax({
type: "POST",
url: "default.aspx/getEventL",
data: JSON.stringify(nEvent),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (response) {
}
});
}
How can I receive and read these two values in the web method?
Can I do just this?
public static object getEventLetter(string var1, string var2)
{
// get event
int _var1= Int32.Parse(var1);
string _var2= var2;
}