I am Developing a Registration Form in ASP.Net in Which i am using client side scripting.So I used jQuery.ajax method to POST all field's data to server through a ASP.Net Web-Service.But when i execute the Jquery.ajax method it calls error function.I tried to debug it using Firebug in Firefox.It showed error 500 Internal Server Error.Now what i assume is that to Insert Data in to a WebService I need to use a POST method and similarly i need a function on Server Side inside Webservice which can be invoked using POST method.I am providing few snippets of code to illustrate what i have done.
//My Client Side Function
function registerUser()
{
var User = {
FirstName:$get("txtFirstName").value,
LastName:$get("txtLastName").value
.
.
//and so on....This way I creat my json object to POST on server
};
//jQuery to POST Data
jQuery.ajax({
type:"POST",
url:"Service/UserRegistration.asmx/InsertUser",
data:User,
success:notifyUser,
error:setErrorField
});
}
//Function for Success Complition function notifyUser(msg) { alert("Registration Successfull"); }
-------Now this was my client script.Now i'll show you my web Service on the server--------
//My C# Web Service Logic
[WebMethod]
public void InsertUser(User use)
{
FreeUser us = new FreeUser();
us.FirstName = use.FirstName;
.
.
//and so on
}
Now What i suppose is that POST method requires WebInvoke class as attribute.so if any one can suggest how do i make method which can be called by a javascript.I may have to use WebInvoke for this.
Thank You.