The following button calls a jQuery function onClick. However, the Firefox dev console says "postData is not defined."
Here is the button and the jQuery script.
<div class="center_text_grid flex-item EMail_Pwd">
<button class="btn_joinnow" id="btn_joinnow" style="color:rgb(255,255,255)" onClick="postData()">Click to Submit Data</button></div>
function sendReply() {
// autoresponder
}
postData().done(sendReply);
</script>
</form><br>
<br><br><br>
<!-- ________________ -->
<script type="text/javascript">
function postData() {
return $.ajax({
var datastring = $("#echo_test").serialize();
$.ajax({
type: "POST",
url: "echo_test.php",
data: {post: datastring},
});
});
}
Why does the console say the function postData is not defined?
Thanks for any ideas.