Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. $("#btnConfirm").click(function() {
  2. saveSomething();
  3. });
  4.  
  5.  
  6.  
  7. function saveSomething() {
  8. var dfd = $.Deferred();
  9. MyApplication.Common.AlertService.prompt("U sure? U wanna save?", "Save").then(function () {
  10. var id = 123;
  11. $.ajax({
  12. type: "POST",
  13. url: $.makeUrl("SomeController", "SomeAction"),
  14. data: { id: id },
  15. dataType: "json",
  16. async: false,
  17. cache: false,
  18. success: function (response) {
  19. if (response.IsError) {
  20. MyApplication.Common.Core.ShowErrorMessage(response.Message);
  21. }
  22. else
  23. {
  24. var entityGrid = $("#MyDataGrid").data("kendoGrid");
  25. entityGrid.dataSource.read();
  26. }
  27. }
  28. }).then(function () {
  29. dfd.resolve();
  30. });
  31. });
  32. return dfd.promise();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement