Hi Everyone,
I am posting json data to the asp.net server page along with the $.post method. But Is there any way to obtain whole data and convert it into anon object.
This is jQuery Code :
var RegisterUser = function() {
var _username = $("#username");
var _password = $("#password");
var _email = $("#email");
var _firstName = $("#firstName");
var _lastName = $("#lastName");
//var _SecurityQuestions = $("#ss");
var _securityAnswer = $("#securityAnswer");
//The registration object that will be sent along with the jquery.post method
var _regObj = {
username: _username.val(),
password: _password.val(),
email: _email.val(),
firstName: _firstName.val(),
lastName: _lastName.val(),
//securityQuestion: _securityQuestions.val(),
securityAnswer: _securityAnswer.val()
};
$.post("login.aspx/callback=RegisterUser",
_regObj,
function(data) {
alert(data);
});
}
C# Code :
public void RegisterUser() {
// Here I wanna get the whole json object and convert into like :
var obj = new JavascriptSerializer().Deserialize(Requetst.PostedJsonObj);
}
I couldn't figure out how to solve in that way, I could use Request.Params["email"],etc. but this seems kinda uncool way...
Thanks...