Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

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:
… 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

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

let me try. Been stuck on this for a week now.
"fn" and "ln" are the members of PersonToSave class
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?
I was talking about the C# PersonToSave class, server side
yes, in C# PersonToSave...what should "fn" and "In" be??
first name and last name (both string)