Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. [OperationContract]
  2. [WebInvoke(Method = "POST", UriTemplate = "/SavePreferences", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
  3. public bool SavePreferences(EmployeeRecord info)
  4. {
  5. //Do stuff
  6. return success;
  7. }
  8.  
  9. var data = {
  10. info: {
  11. //Define the object properties
  12. }
  13. };
  14.  
  15. $.ajax({
  16. type: "POST",
  17. url: "Service.svc/SavePreferences",
  18. contentType: "application/json",
  19. dataType: "json",
  20. data: JSON.stringify(data),
  21. processData: false,
  22. error: function (m) {
  23. alert(JSON.stringify(m, null, 2));
  24. },
  25. success: function (m) {
  26. alert(m.d);
  27. }
  28. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement