Hi I want to invoke a Python code (name of code is match.py) and retrieve its results through HTML/Javascript (I'm using Node JS). What I currently have is:
<div class="panel-body">
<form role="form" method="POST" action="new">
<button type="find" id="find" onclick="match()" class="btn btn-default">Find Match</button>
<script>
$(function() {
$('find').click(function() {
$.ajax({
url: '/Users/reinapark/Downloads/match17/match.py',
data: $('form').serialize(),
type: 'POST',
success: function(response) {
console.log(response);
$("#div1").html(response);
},
error: function(error) {
console.log(error);
}
});
});
});
</script>
</form>
</div>
My questions are: 1. How do I send data to the Python code? 2. What does the #div1 here do?
Sorry if the questions don't make sense - I'm a Python/Node JS beginner not too sure what I'm doing here!!