Using a var as content of .text()

Discussion in 'jQuery' started by oseer, Sep 30, 2011.

  1. #1
    This works:

    $("#result").text("This is text");
    Code (markup):
    But I am trying to use json POST data to show as text, like:

    $("#result").text(data.text);
    Code (markup):
    ...assuming data.text returns "This is text".

    That obviously doesn't work. The solution has to be simple, I just don't see it.... Any ideas?
     
    oseer, Sep 30, 2011 IP
  2. omeslawanya

    omeslawanya Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this will be show on the result element on the "this is text."
     
    omeslawanya, Oct 8, 2011 IP