0

i am using this jquery code:

<script type="text/javascript">
$(document).ready(function () {
    $("#message").hide();
    $("#please_wait_box").hide();
    $("#editcustomer").submit(function (e) {
        $("#message").hide();
        $("#please_wait_box").show();
        e.preventDefault();
        dataString = $("#editcustomer").serialize();
        $.ajax({
            type: "POST",
            url: "editcustomer_go.php",
            cache: false,
            data: dataString,
            success: function (res) {
                $("#please_wait_box").hide();
                $("#message").html(res);
                $('#message').fadeIn('slow');
                if (res.indexOf("success") != -1) {
                    window.location.href = res.substr(8);
                }
            }
        });
    });
});
</script>

to submit forms without changing the page.

then the editcustomer_go.php echoed results display in:

<div id="message" class="messagebox"></div>
<div id="please_wait_box" class="messagebox">Please Wait...</div>

i am using tinymce for text editors - its working okay but when the data is posted in the PHP, its not seeing the changed data in the tinymce text editor - it has to be plain text.

how can i get round this?

4
  • 2
    Can you explain its not seeing the changed data in the tinymce text editor - it has to be plain text.? Commented Oct 2, 2013 at 14:39
  • 1
    For smaller things like mail you use $_POST. If it's getting heavier it's better to use $_DHL. Commented Oct 2, 2013 at 14:40
  • The question title confuses me. How does $_POST fail to work? Commented Oct 2, 2013 at 14:41
  • if i echo $_POST["site info_notes"]; which is the textarea name it displays the old data, not the new data i entered into the textarea Commented Oct 2, 2013 at 15:00

1 Answer 1

1

To grab the data from TinyMCE you need to use their getContent() function.

So in your case it'd be

// Grab a reference to the editor
var ed = tinyMCE.get('tinymceeditorname');
// Get it's content
var editordata= ed.getContent();

... and then just pass editordata along with the rest of the form as the AJAX call data.

Sign up to request clarification or add additional context in comments.

1 Comment

You'd add those two lines inside your $("#editcustomer").submit() function. You'd then need to pass editordata to the AJAX call along with the other data you serialized from your form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.