Camillia
asked on
Saving Jquery to database - web service
If you look at the related question,,,,i need to save firstname, last name to the databse. JQuery is being used. My coworker gave me the solution below but I dont know how to pass the Javascript array to the webservice...
This is the JQuery http://jsfiddle.net/mplungjan/zHQ2d/
His solution is below:
This is the JQuery http://jsfiddle.net/mplungjan/zHQ2d/
His solution is below:
… you should just use an AJAX POST.
I would create a lite Person Object in javascript and match up the definitions with the server side – like this:
[ScriptService]
public class PersonService : WebService
{
[WebMethod]
public void SavePerson(Person PersonToSave)
{
// (assuming Person has a Save() method).
PersonToSave.Save();
}
}
You’d pass in an array of Person in the example above
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"fn" and "ln" are the members of PersonToSave class
ASKER
hmm...not sure what that means... so this these are 2 lines:
var fn = $(this).val();
var ln = $("#"+ln_ID).val();
So, PersonToSave should have "fn" and "ln" doing what?? as parms?
var fn = $(this).val();
var ln = $("#"+ln_ID).val();
So, PersonToSave should have "fn" and "ln" doing what?? as parms?
I was talking about the C# PersonToSave class, server side
ASKER
yes, in C# PersonToSave...what should "fn" and "In" be??
first name and last name (both string)
ASKER