Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>do this with the php page...</p> <pre><code> sleep(2); //Sanitize incoming data and store in variable $name = trim(stripslashes(htmlspecialchars($_POST['name']))); $email = trim(stripslashes(htmlspecialchars($_POST['email']))); $message = trim(stripslashes(htmlspecialchars($_POST['message']))); $recipient = "info@internetmarketingtrio.com"; //Validate data and return success or error message $errors = array(); $reg_exp = "/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,4}$/"; if (!preg_match($reg_exp, $email)) { $errors[] = "&lt;p&gt;A valid email address is required.&lt;/p&gt;"; } if (empty($name) || $name == '') { $errors[] = "&lt;p&gt;Please provide your name.&lt;/p&gt;"; } if (empty($message) || $message == '') { $errors[] = "&lt;p&gt;A message is required.&lt;/p&gt;"; } if(empty($errors)) { $return['success'] = true; $return['message'] = "&lt;p&gt;Thanks for your feedback " .$name. ".&lt;/p&gt;"; } else { $return['success'] = false; $return['message'] = "&lt;h3&gt;Oops! The request was successful but your form is not filled out correctly.&lt;/h3&gt;"; foreach($errors as $error) { $return['message'] .= $error ."&lt;br /&gt;"; } } </code></pre> <p>And then in your call to get this page... the ajax call...</p> <pre><code>$.ajax({ type: 'POST', url: 'feedback.php', data: formData, dataType: 'json', cache: false, success: function(data) { if(data.success) { $("form#response").removeClass().addClass('success').html(data.message).fadeIn('fast'); removeResponse(5000); } else { $("form#response").removeClass().addClass('error').html(data.message).fadeIn('fast'); } } }); function removeResponse(time) { setTimeout(function() { $("form#response").fadeOut('fast'); }, time); } </code></pre> <p>And that should do ya</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload