我的主要编码语言(VisualFoxPro 9)中有一个变量字符串的Ajax传输,如下所示:
AjaxResponse = CREATEOBJECT("Custom")
lcMessage = "<li class='hello'>Hello</li>"
AjaxResponse.AddProperty("Reply", lcMessage)
Response.ContentType = "text/html"
Response.Write(AjaxResponse.Reply)
在使用jquery函数.ajax()时,我创建了一个success:函数,如下所示:
$.ajax({
url: 'index?Proc=GetUuserHistory',
dataType: "html",
success: function(data){
$("div#history-text").html('<ul>' + data + '</ul>');
};
});
我的问题是,插入“div history text”的文本没有格式化,仍然包含li标记。我尝试用.text替换.prepend,.append和.html,但没有成功…是否有一种方法可以在使用Ajax接收到该字符串后将其转换回HTML格式?