1

I am a jQuery newbie and ma trying to use a modal to reveal a constant contact simple form generated by the form generator. I have applied jQuery.validate(), and the validation is working, but I don't know how to submit the form. If there is an action="signup/index.php" in the tag, i land on a new page.

The generated form uses action='signup/index.php' and this file calls for a new page location see file in Github. I commented those last lines out, but still am failing to make the form submit. I cannot see the new email in the Constant Contact email list.

This is my sumbmit handler

submitHandler: function() {
        $('#signup').click(function(e) {
            $.post('signup/index.php', $().serialize(), function(data) {
                $('#output-div').html(data);
            });
            $('#form-message').fadeIn(300, function() {
                $('#form-message').html('<p>Thank you for joining our list.  Great offers coming soon.</p>')
            });
            $('#myModal').delay(1500).trigger('reveal:close');
        });

    }
sandraqu
  • 1,428
  • 1
  • 14
  • 31

1 Answers1

0

solved it.

I had commented out the last several lines of the signup/index.php, including this line

if($postFields['request_type'] == 'ajax'){ $postFields["success_url"]=''; $postFields["failure_url"]=''; }

For some reason, that line is needed for form submittal success. Everything after that line is commented out, from

if ($return_code==201) {

to

</ol>
        </p>'; }
    }

and my jQuery is handling messages, errors and completion as such

submitHandler: function() {
        $.post('/dev/rest/ccphp/signup/index.php', $("#ccsfg").serialize(), function(data) {
            $('#results').html(data);
        }).success(function() { 
            $('#ccsfg').html('<h4>Thank you for joining our list.  Great offers coming soon.</h4>');
        })
            .error(function() {
            $('#ccsfg').html('<h4>Oops!  There was an error.  Please try again. </h4>');
         })
            .complete(function() {
            $('#myModal').delay(1500).trigger('reveal:close');
         });
    }
sandraqu
  • 1,428
  • 1
  • 14
  • 31