I'm fairly new to JavaScript and I'm trying to figure out a way to, instead of showing a "Thank You" div when a user hits the "Submit" button of my form, go to an HTML page of my choosing, i.e., www.site.com/thanks.html. I've found a few different ways that this is possible, but have yet not be able to successfully implement anything within this specific form and need a bit of help.
Here is the form HTML:
<div class="row">
<div class="span12">
<div id="success"></div>
</div>
<div class="span6">
<div class="control-group controls-row">
<input class="inputbox span3" type="text" id="rp_name" name="rp_name" placeholder="Name" value="" />
<input class="inputbox span3" type="text" placeholder="Email" name="rp_email" id="rp_email" value="" />
</div><!-- end control group -->
<div class="control-group">
<input class="inputbox span6" type="text" name="rp_subject" placeholder="Subject" id="rp_subject" value="" />
</div><!-- end control group -->
<div class="control-group">
<input class="btn" id="submit-form" type="submit" name="submit" value="Send Message" />
</div><!-- end control group -->
</div>
<div class="span6">
<div class="control-group">
<textarea class="textarea span6" placeholder="Available Days" name="rp_message" id="rp_message">
</textarea>
</div><!-- end control group -->
</div>
Here is where it's pulling the "success message" js from:
$.ajax({
type: 'POST',
url: 'php_helpers/contact_form.php',
data: data_html,
success: function(msg){
if (msg == 'sent'){
success.html('<div class="alert alert-success">Message <strong>successfully</strong> sent!</div>') ;
$('#rp_name').val('');
$('#rp_email').val('');
$('#rp_message').val('');
}else{
success.html('<div class="alert alert-error">Message <strong>not</strong> sent! Please Try Again!</div>') ;
}
}
});
So I need to swap out the "div class="alert alert-success"" area with a redirect. Hoping this is a simple fix!
Thanks for any help!