Help submitting a form to a JQuery script using a javascript submit() function
<p>I attempted to ask this question last week without a resolution. I am still unable to get this to work. What I would like to do is submit data entered through a WYSIWYG <strong>javascript</strong> editor to a JQuery script I have that will first tell the user if they are trying to submit an empty textbox The last thing I need it to do is tell the user if their data was entered successfully or not.</p>

<p>I am having a problem inside the JQuery script as nothing is being executed when I click the save button.</p>

<p>This editor uses javascript submit() that is tied to a small save icon on the editor. When the user presses the button on the editor, it fires the function I have in the form tag. That's about as far as I was able to get.</p>

<p>I think there is an issue with the form tag attributes because when I click <strong>anywhere</strong> on the editor, the editor jumps down off the bottom of the screen. I believe it has something to do with the onclick event I have in the form tag.</p>

<p>The first part of the JQuery script is supposed to handle form validation for the textarea. If that's going to be really difficult to get working, I'd be willing to let it go and just handle everything server side but I just need to get the data POSTed to the JQuery script so that I can send it to my php script.</p>

<p>Thanks for the help guys.</p>

<pre><code>&lt;form name="rpt" class="rpt" id="rpt" action="" onclick="doSave(); return false;"&gt;
</code></pre>

<p><hr /></p>

<pre><code>function doSave()
{
  $(function()
  {
    $('.error').hide();
    $(".rpt").click(function()
    {
      $('.error').hide();
      var textArea = $('#report');
      if (textArea.val() == "")
      {
        textArea.show();
        textArea.focus();
        return false;
      }
      else
      {
          return true;
      }
     var dataString = '&amp;report='+ report;
     alert (dataString);return false;

      $.ajax({
          type: "POST",
          url: "body.php?action=customer",
          data: dataString,
          dataType: 'json',
          success: function(data){
              $('#cust input[type=text]').val('');
              var div = $('&lt;div&gt;').attr('id', 'message').html(data.message);
              if(data.success == 0) {
                  $('#cust input[type=text]').val('');
                  $(div).addClass('ajax-error');
              } else {
                  $('#cust input[type=text]').val('');
                  $(div).addClass('ajax-success');
              }
              $('body').append(div);
            }
      });
      return false;
    });
  });
}
</code></pre>
