jQuery AJAX converting variable string to html styled text
Posted
by sadmicrowave
on Stack Overflow
See other posts from Stack Overflow
or by sadmicrowave
Published on 2010-05-07T20:34:10Z
Indexed on
2010/05/07
20:38 UTC
Read the original article
Hit count: 316
I've got an AJAX transmission of a variable string in my primary coding language (Visual FoxPro 9) that looks like this:
AjaxResponse = CREATEOBJECT("Custom")
lcMessage = "<li class='hello'>Hello</li>"
AjaxResponse.AddProperty("Reply", lcMessage)
Response.ContentType = "text/html"
Response.Write(AjaxResponse.Reply)
While using the jQuery function .ajax() I've created a success: function that looks like this:
$.ajax({
url: 'index?Proc=GetUuserHistory',
dataType: "html",
success: function(data){
$("div#history-text").text(data);
};
});
My problem is that the text inserting into 'div#history-text' is unformatted and contains the li tags still. I've tried substituting the .text for .prepend, .append, and .html with no luck...is there a way to convert this string back to html format after its been received using Ajax?
© Stack Overflow or respective owner