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 trial

JavaScript

popup box on submission

how do l get a popup box appear on submission. l am using ajax for the form and want to include the code somewhere but its not working. any help please

     var newHtml = '<a href="#codepopup" class="btn fancybox submit" type="submit" id="submit" name="sendMessage" value="submit">' + 'Submit' + '</a>';

          $(document).ready(function(){
            $("#form").validate({
              submitHandler: function(){
                $this = $(this);
                $.ajax({
                  type: "POST",
                  url: "form-post.php",
                  data: $("#form").serialize()
                }) return true;
                  .done(function( msg ) {
                  $('#submit').click(function(){
                    $this.replaceWith(newHtml);
                  })  ;


                  });
              }
            });
          });

any ideas how l can fx this would be greatly appreciated guys. thanks.