tags:

views:

12

answers:

1

hi...i've been a prototype user for a few years, and now for several reasons, i'm moving to jquery.. but still have yet familiarize myself with jquery's syntax.. my question is

how do I convert this prototype code to jquery correctly?

new Ajax.Updater('displayArea', 'shoutbox.php', { method:'post',
    parameters: {action: 'display', some_data: some_data}
});

and here's what i did:

$.post("shoutbox.php", {action: "display", some_data: some_data}, function(data){$("#displayArea").text(data);},"html");

i got the exact return result from jquery and prototype, but the problem is, when jquery updates the "displayArea", it's not quite what I expected. the returned data has some html codes in it, and instead of displaying a new line for the html tag 'br', jquery just display the 'br' in plain text. what i means is it's displaying html codes, and that's not what I want. hope you all get what i meant....

thanks

+1  A: 

jQuery.text() method as its name implies, is used to insert a text, not HTML code. Use jQuery.html() instead.

$("#displayArea").html(data);
Crozin
thanks a lot Crozin!!
imin