How to call a server side method with custom parameters.

Jun 2 2014 2:20 AM
How to call a server side method with custom parameters as inputs via jquery ajax functionality?
 
public class Employee
{
public int ID { get; set; }
public string Name { get; set; }
}
 
 [WebMethod]
public static void AddEmployee(Employee employee)
{
//Some logic
}
 
 
In my design I have two textboxes for inputting ID and Name of the employee. On clicking the button I need to invoke the method AddEmployee.
 
How can I pass the values to the WebMethod AddEmployee via jquery ajax?
 
Please mention a solution for these kind of scenarios. 
 
 

Answers (4)