-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmission.js
More file actions
26 lines (23 loc) · 1.01 KB
/
submission.js
File metadata and controls
26 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Load up the function when the document is ready (standard JQuery style!)
$(document).ready(function() {
// Check the #tagForm and when submitted
$("#tagForm").submit(function(e){
// Prevent the default operation of the submission from taking place
e.preventDefault();
// Grab the value of the tag text box and put into a variable
tagDescription = $('#TagDescription').val();
// Create a JSON object that can be pushed into the API endpoint
let jsonObject = {TagDescription: tagDescription};
// POST the JSON object to the API endpoint
$.ajax({
method: "POST",
url: "https://<API-GATEWAY-ADDRESS>/<STAGE>/putTagsForWishTree",
data: JSON.stringify(jsonObject),
dataType: 'json',
crossDomain: true,
}).done(function (msg) {
// If successful, then reload the page so that the new tag can be loaded in
location.reload();
});
});
});