Advertisement
LoganYoung87

Untitled

Jun 13th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.27 KB | None | 0 0
  1. $("button.confirm_invoice").on("click", function () {
  2.     console.log("confirm executed");
  3.     $("#p2").show();
  4.     var Store = $("#Store").val(); // text value (store name)
  5.     console.log(Store);
  6.     var From = $("#FromDate").val(); // datetime string '2016-06-13 08:02:34 PM'
  7.     console.log(From);
  8.     var To = $("#ToDate").val(); // datetime string '2016-06-13 08:02:34 PM'
  9.     console.log(To);
  10.     var Amount = $("#inv-total").html(); // 37.00
  11.     console.log(Amount);
  12.     var InvoiceNumber = $("#InvoiceNumber").html(); // INV0001
  13.     console.log(InvoiceNumber);
  14.  
  15.     var invoice = { "StoreName": Store, "FromDate": From, "ToDate": To, "Amount": Amount, "EmailAddress": EmailAddress, "EmailMessage": EmailMessage, "InvoiceNumber": InvoiceNumber }
  16.     console.log(invoice);
  17.     console.log("Invoice generated, about to post");
  18.     $.post("/Invoice/SaveInvoice", invoice, function (data) {
  19.         console.log("post succeeded");
  20.         $("#p2").hide();
  21.         if (data.IsOk == true) {
  22.             console.log("data is okay");
  23.             location.href = "/Invoice/Invoice?id=" + data.InvoiceId;
  24.         }
  25.         else
  26.         {
  27.             console.log("data is not okay");
  28.             showMessage(data.Data.Title, data.Data.Message)
  29.         }
  30.     }, "json");
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement