aVianditasus
New Member
Am having trouble with a 'post'.am getting User Object always null.. Im at my wits end and have been researching this for days, so if anyone has any ideas, please help! Thanks in advanceMy Jquery looks like this\[code\]$(document).ready(function () { $("#register").click(function (e) { e.preventDefault(); //stop the submit event for the submit button var Name = $("#register_username").val(); var Email = $("#register_email").val(); var Password = $("#register_password").val(); var Contact = $("#register_contactNumber").val(); var Adress = "Seteelte Town"; var chkUserType = document.getElementById("identity_type_2").checked; var userinfo = { "request": { "Action": { "Address": Adress, "Children": [], "CityId": 0, "Email": Email, "HomeUser": chkUserType, "ImagePath": "", "IpAdress": "", "IsActive": false, "LastLogin": "", "Name": Name, "Password": Password, "PhoneNumber": Contact, "ProfileHit": 0, "ShowEmail": false, "ShowPhoneNumber": false, "SubscribeNews": false, "UserID": 0}} }; alert("Input: " + JSON.stringify(userinfo)); $.ajax({ type: "POST", url: '/Services/Membership.svc/AccountAdd', data: JSON.stringify(userinfo), dataType: 'json', contentType: "application/json; charset=utf-8", success: function (data) { alert(data.Result); }, error: onError }); }); });\[/code\]My C# code for WCF is\[code\][AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Membership : IMembership { public SMProcessResponse<bool> AccountAdd(SMProcess<User> request) { return new SMProcessResponse<bool>(MembershipController.AccountAdd(request.Action)); }}\[/code\]C# code for process request is\[code\][DataContract(Namespace = "")] public class SMProcess<T> : BaseRequest { public SMProcess(T obj) { // TODO: Complete member initialization this.Action = obj; } [DataMember] public T Action { get; set; } }\[/code\]