Javascript error in IE7 and IE8 when submitting AJAX form

I'm attempting to debug the AJAX form code (used to create an interest form on my site) and although it works, I'm consistently getting a syntax error in IE7 and IE8 (verified on Windows XP and Windows 7). This is particularly annoying in that it causes an unwarranted error dialog (intermittently, of course) to appear in front of my users. Not a great experience.

I'm stumped, however, as to what the cause of the error actually is. I've narrowed it down to where the data option is getting set in the ajax call, and it seems to be related to the Campaign Monitor URL that needs to be accessed by the form. Encoding the url fixes the error, but then the form fails to get submitted.

It's worth nothing that I'm using jQuery 1.4.3 and jQuery UI 1.8.5. Downgrading removes the JS error (well, this one), but causes many more, and I'm hesitant to go down the path of attempting to debug (and retest) all of those unless I know for absolute certain that that is the only possible solution.

Any help would be greatly appreciated.

Here's the code:

<script>
  $(document).ready(function(){
    $("#inviteForm").validate({
      errorClass: "fieldWithErrors",
      validClass: "valid",
      highlight: function(element, errorClass, validClass) {
        $(element).parent("div").addClass(errorClass);
      },
      unhighlight: function(element, errorClass, validClass) {
        $(element).parent("div").removeClass(errorClass);
      },
      submitHandler: function() {
        var formAction = $("#myForm").attr("action"); // here's where the trouble starts
        var id = "my_id";
        var emailId = id + "-" + id;
        var str = $("#myForm").serialize();

        // Add form action to end of serialized data
        // CDATA is used to avoid validation errors
        //<![CDATA[
        var serialized = str + "&action=" + formAction;
        // ]]>

        $.ajax({
          url: "http://my.tld/path_to/proxy.php",
          type: "POST",
          data: serialized, // this seems to be the problem line
          success: function(data) {
          // Server-side validation
          if (data.search(/invalid/i) != -1) {
          $("#formErrorMsg").html("<div class='error content'><h4>Please correct the following errors:</h4><p style='text-align: left'>You must enter a valid email address to be added to the interest list.</p>");
          $("#formErrorMsg").css('display', 'block');
        }
        else {
          $("#formErrorMsg").css('display', 'none');
          $("#inviteForm")[0].reset();
          $("#formSuccessMsg").css('display','block');
        }
      }
    });
  }
});
});
</script>

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098