Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp submitting a form to a JQuery script using a javascript submit() function
    primarykey
    data
    text
    <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> <hr> <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>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload