Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTom Philpotts
167 PointsContact form Foundation Zurb
This is my first time using foundation for a build, previously I have used bootstrap.
I have the contact form working and send the emails correctly.
But it is redirecting to another page, how do I get it to simple say thank at the bottom of the form?
Tom Philpotts
167 PointsThis is the form
<form id="ajax-contact" method="post" action="mailer.php">
<div class="field">
<input type="text" name="name" placeholder="first name" required></input>
</div>
<div class="field">
<input type="text" name="surname" placeholder="last name"></input>
</div>
<div class="field">
<input type="text" name="phone" placeholder="telephone" required></input>
</div>
<div class="field">
<input type="email" name="email" placeholder="email" required></input>
</div>
<div class="field">
<textarea type="message" name="message" placeholder="message" required></textarea>
</div>
<div class="field">
<button type="submit">send</button>
</div>
</form>
<div class="form-messages"></div>
Tom Philpotts
167 PointsI was following the AJAX tutorial from Treehouse (http://blog.teamtreehouse.com/create-ajax-contact-form), but could not add in more fields, so took the PHP from another site I built.
I got the AJAX form from the tutorial to work, but it redirects to another page.
I am still a beginner with PHP and Javascript. I know I could add the toggle class on the 'submit' button, however, how would I make sure this was only done on success?
Thank you in advance.
The website is: atonestyling.com.
Tom Philpotts
167 PointsTom Philpotts
167 Pointsthe code I am using is as follows: