<?php
/**
* @author Leroy Johnson
* @copyright 2010
*/
?>
<script src="../js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$("form").submit( function()
{
var post = $("#comment").val();
$.ajax
({
type : "POST",
url : "../classes/ajax.php",
data : {"comment":post},
success : sendToValidate,// need to rebuild the post array
error : function(e){ alert(e.responseText);}
});
return false;
});
});
function sendToValidate(data)
{
$.ajax
({
type : "POST",
url : "../classes/comment.php",
data : {"comment":data},
success : function(resp){ /* do other stuff...*/ $("#msg").text("Your string is now safe for database."); $("#comment").val(resp);},
error : function(e){ alert(e.responseText);}
});
}
</script>
<span></span>
<style>
#form_error, #req
{
color:red;
}
#form_error
{
border: 1px solid red;
background:light red;
width: 220px;
padding:2px;
text-align: center;
margin-left:20px;
}
.boxes{
width:200px;
}
p.error
{
color:#EE2037;
margin-top:0;
overflow:hidden;
font-size: .9em;
padding-left:5px;
width:200px;
}
.termContainer
{
border:1px solid #CCCCCC;
height:150px;
width: 250px;
padding: 5px;
overflow:auto;
z-index:1;
}
</style>
<!-- TODO: Add te following fields
address, secondary address, city, state, zip, birthdate,
checkbox for mailing list, checkbox for tos and privacy policy,
-->
<h1 style='color:#2F8B1E;font-family:arial;margin-bottom:0px;'>Sample Comment Form </h1><hr />
<p id='msg' style='color:red;'> <?php echo isset($error)?$error:'';?> </p>
<?php
include("../forms/comment_form.php");
?>
|