JSFiddle - React, Tailwind, and code Playground
by Tejash Soni
HTML
<form id="myForm" action="" method="post">
<select name="Type">
<option value="1">(1 on 1)</option>
<option value="2">(2 on 2)</option>
<option value="3">(3 on 3)</option>
<option value="4">(4 on 4)</option>
</select>
<input type="button" id="submit-btn" value="Advertise in Public Chat" />
</form>
<div id="message"></div>
JavaScript
$("#submit-btn").click(function(){
//alert("in");
var dataString = "data";
$.ajax({
type: "POST",
url: "http://tazz.bugs3.com/test/test.php",
data: {"data":dataString},
success: function(response) {
if (response === "received"){
$('#message').html("<h2>Message sent to Chat!</h2>");
}
}
});
});
/*
there is problem with JSFIDDLE, Its not allowing to call external ajax call from this code. check replacing url of your domain.
PHP CODE
<?php
if (count($_POST) > 0){
echo "received";
}else{
echo "not received";
}
exit;
?>
*/