JavaScript PHP removing everything after HTML tags removing everything after a character using excel,removing everything after

I have a contenteditable div like this:

<form>
    <div name="new_post" class="post" contenteditable="true"></div>
    <button type="submit">Submit</button>
</form>

The contenteditable div allows bold and italic tags, but no other tag.

My issue is that if the user types something like Hello there <u>world</u>!, it will save in the database as Hello there. It seems to remove everything after the tags and I don't know why.

I'm using AJAX and PHP to handle posts, so here's the rest of the code.

Ajax:

$(document).ready(function() {
    $(document).on("submit", "form", function(event) {
        event.preventDefault();
        alert($('.post').html()); // added this to debug it. This prints "Hello there &lt;u&gt;world&lt;/u&gt;!"
        $.ajax({
            url: 'php/post.php',
            type: 'POST',
            dataType: 'json',
            data: $(this).serialize() + "&post_field=" + $('.post').html(),
            success: function(data) {
                alert(data.message);
            }
        });
    });
});

PHP:

<?php
    $post = $_POST["post_field"];

    // query to insert post into database goes here

    $array = array('message' => $post);

    echo json_encode($array);
?>

Please help!

Answer:1

so i'm new to javascript and jquery. Need some help on how to run the 2nd function after the 1st one has completed? The first function is a progress bar and the second one is a form that i want to ...

so i'm new to javascript and jquery. Need some help on how to run the 2nd function after the 1st one has completed? The first function is a progress bar and the second one is a form that i want to ...

  1. jquery function after page load
  2. jquery function after delay
  3. jquery function after load
  4. jquery function after function complete
  5. jquery function after .each() has completed
  6. jquery function after function
  7. jquery function after animate
  8. jquery function after append
  9. jquery function after fadeout
  10. jquery function after another
  11. jquery function after timeout
  12. jquery function after time
  13. jquery function after ajax load
  14. jquery function after click event
  15. jquery function after page load complete
  16. jquery function after click
  17. jquery function after load html
  18. jquery function after dom load
  19. jquery function after submit
  20. jquery function after addclass

This is purely for debugging purposes. Is there a single command like addEventListener('*', myHandler) in native js or $(document).on('*', myHandler) in jQuery that would listen for any event ...

This is purely for debugging purposes. Is there a single command like addEventListener('*', myHandler) in native js or $(document).on('*', myHandler) in jQuery that would listen for any event ...

Suppose i have an Array of objects in javascript : var obj0 = new Object(); var obj1 = new Object(); var obj2 = new Object(); var obj3= new Object(); var array = new Array(obj0,obj1,obj2,obj3); if ...

Suppose i have an Array of objects in javascript : var obj0 = new Object(); var obj1 = new Object(); var obj2 = new Object(); var obj3= new Object(); var array = new Array(obj0,obj1,obj2,obj3); if ...

  1. null object where

I am working on the symfony framework first time. And web site is highly depend on the CSS , javascript and jquery. I need to fire this all command each time to test small css change also. app/...

I am working on the symfony framework first time. And web site is highly depend on the CSS , javascript and jquery. I need to fire this all command each time to test small css change also. app/...

  1. change check without id