Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. [ServiceContract]
  2. public interface IService
  3. {
  4.  
  5. [OperationContract]
  6. [WebInvoke(Method = "POST")]
  7. void Delete(int id);
  8.  
  9. }
  10. public class Service : IService
  11. {
  12. public void Delete(int id)
  13. {
  14. //I do Some Work
  15. }
  16. }
  17.  
  18. $(function () {
  19. function successDel(data) {
  20. alert('done');
  21.  
  22. }
  23. callService("MyserviceAddress/Delete", "POST", JSON.stringify({"id":"11"}), successDel, function errordel(xhr, status, error) {
  24. alert(error);
  25. }, "application/json; charset=utf-8", "json");
  26.  
  27. })
  28. function callService(url, type, data, successFunc, errorFunc, contentType, dataType) {
  29. $.ajax({
  30. url: url,
  31. type: type,
  32. cache: false,
  33. proccessData: false,
  34. contentType: contentType,
  35. dataType:dataType,
  36. data: data,
  37. success: successFunc,
  38. error: errorFunc
  39. })
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement