I am trying to do an HTML Contact form that will send an email via MailGun
I am following the instructions here to do this using Ajax and PHP
I have no experience in PHP and want a simple way of debugging.
Thus I want to add popup messages to my send.php
I can get wwwroot\hello.php to work, so I know PHP is available.
<?php
echo("hello php");
?>
I have tried the following in send.php but I do not see any messages
<?php
echo "Hello Send2";
if( isset($_POST) ){
echo "In post.";
phpAlert("in post2");
$postData = $_POST;
$mailgun = sendMailgun($postData);
if($mailgun) {
echo "Great success.";
} else {
echo "Mailgun did not connect properly.";
}
}
// etc
The Ajax call is
var dataString = '<p><strong>Name: </strong> '+ name + '</p><p><strong>Email: </strong> ' + email + '</p><p><strong>Message: </strong> ' + message + '</p>';
$.ajax({
type: "POST",
url: "script/send.php",
data: { data: dataString, senderAddress: email },
success: function() {
alert("Got success");
I do get the javascript "Got success" message but I am trying to troubleshoot why send.php does not work.
I am thinking the first step would be to be able to add calls to echo but nothing shows.
send.php does contain calls to curl so I am guessing my next question may be about how to set that up in Azure, but first I would like to know why echo does not work from inside send.php