SHARE
TWEET

Untitled

Caminhoneiro Dec 13th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <form onsubmit="return subscribe()">
  3.     Subscribe to all events <input type="submit" value="submit">
  4. </form>
  5. <form onsubmit="return unsubscribe()">
  6.     Unsubscribe from all events <input type="submit" value="submit">
  7. </form>
  8. <form onsubmit="return notifymvc()">
  9.     Trigger notification through MVC controller <input type="submit" value="submit">
  10. </form>
  11. <form onsubmit="return notifyapi()">
  12.     Trigger notification through Web API controller <input type="submit" value="submit">
  13. </form>*@
  14.  
  15. @*<script>
  16.     function subscribe() {
  17.         $.ajax({
  18.             type: "POST",
  19.             url: "/api/webhooks/registrations",
  20.             data: JSON.stringify({
  21.                 WebHookUri: "http://localhost:XXXXX/api/webhooks/incoming/custom",  // Substitute XXX for your localhost
  22.                 Secret: "12345678901234567890123456789012",
  23.                 Description: "My first WebHook!"
  24.             }),
  25.             contentType: "application/json; charset=utf-8",
  26.             dataType: "json",
  27.             success: function (data, status) { alert(status); },
  28.             failure: function (errMsg) { alert(errMsg); }
  29.         });
  30.         return false;
  31.     }
  32.  
  33.     function unsubscribe() {
  34.         $.ajax({
  35.             url: "/api/webhooks/registrations",
  36.             type: 'DELETE',
  37.             success: function (data, status) { alert(status); },
  38.             failure: function (errMsg) { alert(errMsg); }
  39.         });
  40.         return false;
  41.     }
  42.  
  43.     function notifymvc() {
  44.         $.post("/notify/submit",
  45.             {},
  46.             function (data, status) { alert("Data: " + data + "\nStatus: " + status); });
  47.         return false;
  48.     }
  49.  
  50.     function notifyapi() {
  51.         $.post("/api/notifyapi",
  52.             {},
  53.             function (data, status) { alert("Data: " + data + "\nStatus: " + status); });
  54.         return false;
  55.     }
  56. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top