Advertisement
Guest User

Untitled

a guest
May 29th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3. document.getElementById('submitButton').onclick, function() {
  4.  
  5. var form = $('#videoForm');
  6.  
  7. $.ajax({
  8. method: 'get',
  9. url: 'dashboard/video/upload/payment/submit',
  10. data: {
  11. 'length': $length,
  12. },
  13. 'ajax': true,
  14.  
  15. success: function(data) {
  16.  
  17. try {
  18. data = JSON.parse(data)
  19. } catch (e) {
  20. return alert("Error parsing response");
  21. }
  22.  
  23. if (data) {
  24. $signature = data['signature'];
  25. $expiration = data['expiration'];
  26. document.getElementsByTagName("camera")[0].setAttribute("data-signature", $signature);
  27. document.getElementsByTagName("camera")[0].setAttribute("data-signature-expiration", $expiration);
  28. myCamera.publish();
  29. } else {
  30. return alert("Payment could not be completed");
  31. }
  32. },
  33. error: function(data) {
  34. // Error from the server (404, 503)
  35. }
  36. });
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement