I am trying to create an HTML form that tallies who is at a sports game, and then pass that data to Microsoft Flow. I have the html form behind a JavaScripted Geofence. I want to be able to take that form data, and without a page refresh, compile it into a JSON, then pass it to Microsoft Flow, without using PHP or an inbetween step.
I have read that AJAX may help me do this, but AJAX seems to be used mostly to POST data to a PHP file. I am not entirely sure how the Flow trigger works. I am using the Flow trigger "When an HTTP Request is Received". How would I go about giving data from this form to Flow? Thank you. (to clarify the code, when the check in button is pushed, getLocation() makes the form visable).
<h4 id="loc" style="text-align:center;"></h4><br>
<h4 id="word" style="text-align:center;"></h4><br>
<div class="wow fadeInUp" data-wow-delay="0.2s" style="text-align:center;">
<form id="yummyfood" style="display:none;" action="javascript:void(0);" name="CheckIn" method="post">
<p><label for="name">First Last Name. (Use same name every time or you won't get your points.)</label>
<input type="text" name="name" id="name"></p>
<p><label for="email">School Email Address</label>
<input type="text" name="email" id="email"></p>
<p><label for="grade">What Grade are you in?</label>
<input type="text" name="grade" id="grade"></p>
<p><label for="game">Which game are you at?</label>
<input type="text" name="game" id="game"></p>
</form>
<button value="Submit" type="button" onclick="formdone()">
</div>
<!--FormScript-->
<script>
function submit(){
console.log("i win")
}
function submitform() {
console.log("one")
var form = document.getElementById("yummyfood")
var formData = JSON.stringify($("#myForm").serializeArray());
$.ajax({
type: "POST",
url: "https://prod-93.westus.logic.azure.com:443/----Fay0OuN2k",
data: formData,
success: function(formdone){},
dataType: "json",
contentType : "application/json"
console.log(formData)
});
}
function formdone() {
yummyfood.style.display = 'none'
}
</script>
I am getting nothing from this and many many variations of it. Any help is appreciated.