Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form onsubmit="return subscribe()">
- Subscribe to all events <input type="submit" value="submit">
- </form>
- <form onsubmit="return unsubscribe()">
- Unsubscribe from all events <input type="submit" value="submit">
- </form>
- <form onsubmit="return notifymvc()">
- Trigger notification through MVC controller <input type="submit" value="submit">
- </form>
- <form onsubmit="return notifyapi()">
- Trigger notification through Web API controller <input type="submit" value="submit">
- </form>*@
- @*<script>
- function subscribe() {
- $.ajax({
- type: "POST",
- url: "/api/webhooks/registrations",
- data: JSON.stringify({
- WebHookUri: "http://localhost:XXXXX/api/webhooks/incoming/custom", // Substitute XXX for your localhost
- Secret: "12345678901234567890123456789012",
- Description: "My first WebHook!"
- }),
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function (data, status) { alert(status); },
- failure: function (errMsg) { alert(errMsg); }
- });
- return false;
- }
- function unsubscribe() {
- $.ajax({
- url: "/api/webhooks/registrations",
- type: 'DELETE',
- success: function (data, status) { alert(status); },
- failure: function (errMsg) { alert(errMsg); }
- });
- return false;
- }
- function notifymvc() {
- $.post("/notify/submit",
- {},
- function (data, status) { alert("Data: " + data + "\nStatus: " + status); });
- return false;
- }
- function notifyapi() {
- $.post("/api/notifyapi",
- {},
- function (data, status) { alert("Data: " + data + "\nStatus: " + status); });
- return false;
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement