I am trying to make a simple website that posts information to an api and shows output as alert. But I can't get any alert. Code:
<!DOCTYPE html>
<html>
<body>
<b>Enter name</b>
<br>
<input type="text" id="name">
<br>
<button id="button1">Submit</button>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script>$('#button1').click(function(){
$.ajax({
type: "POST",
url: "http://(api url)",
data :{name:$('#name').value()},
});
});
</script>
</body>
</html>