Web Analytics Made Easy -
StatCounter include a copyright symbol via JSON/ajax/DOM methods - CodingForum


No announcement yet.

include a copyright symbol via JSON/ajax/DOM methods

  • Filter
  • Time
  • Show
Clear All
new posts

  • include a copyright symbol via JSON/ajax/DOM methods

    I have some text content that is displayed via ajax to server and response is JSON.
    This is used to construct html elements with DOM methods. The code for copyright
    symbol is rendered literally, not as a copyright symbol. Is there a way of including
    a copyright symbol in this manner?

  • #2
    If you mean download the image as part of the JSON response, then convert the image to base64, download it as part of the JSON response.

    On the client side, just point the <img src> to that base64 string.


    • #3
      Thank you for your reply:

      No, I am trying to include a copyright symbol. If I add it with key combo OPT-g, the browser doesn't know what it is.
      (it shows a question mark inside of a triangle). If it is represented as an html entity, it is rendered literally: &copy;
      In response to the ajax query, php reads an associative array. The array values are JSON encoded. IT puts out
      a combined string in a foreeach loop.
      The ajax callback function reads the JSON and uses it as arguments to document.createElement and document.createTextNode.
      The symbol should be included in one of the text nodes. For now I am just have it as 'copyright'.


      • #4
        As I understand it, you have a character you want to display as a copyright symbol.

        Long shot, but you probably need a font family that supports that character.


        • #5

          Try the following HEX equivalents:
           echo 'Works when tested with my AJAX ==>  &#xA9;  &#x24B8;' ;