I have a question regarding jquery and javascript post request loop.
I am quite new to javascript, so i need help to creating a post loop.
I have this: User input field: x@x.com;y@y.com (the user can specify emails divided by semicolon.
Right now i have this:
<button id="sendwebhook">Send</button>
<script>
$(document).ready(function() {
$('#sendwebhook').click(function() {
$.ajax({
url: "https://somesite.com/...",
type: "POST",
data: JSON.stringify(
{ "email":"x@x.com" }
),
complete: function(){ alert("Success") }
});
});
});
</script>
What i want to do is send a post request per email in the input field. So in this case i want to send this:
{
"email":"x@x.com"
},
{
"email":"y@y.com"
}
Or make two post requests with one json string. The user should be able to insert an unlimited amounth of emails, so i should be some kind of loop.