SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2012
    Location
    Lancaster,UK
    Posts
    32
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Tags/special characters get converted from HTML to plain text

    Hi there,

    When I get content from the database like in the code below, all tags are converted to plain html. So instead of BOLD TEXT I see </b>BOLD TEXT</b> .
    How do I preserve the special characters, lines between paragraphs, etc.?

    Code:
    // Make a call to the server to retrieve all data
    function retrieveResults(handleData) {
        return $.ajax({
            url: "forms-processing.php",
            type: 'POST',
            dataType: 'json',
            data: "projects=true",
            success: function(data) {
            	handleData(data);
            }
        });
    }
    Code:
    retrieveResults(function(output){
    		$('#content').append(output[1].content));
    });

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    I would guess that the server is returning escaped HTML.

    If you add this to your success callback, what do you see?

    Code:
    success: function(data) {
      console.log(data);
      handleData(data);
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •