简体   繁体   English

jQuery无法以HTML作为内容追加到有序列表

[英]Jquery cannot append to a ordered list with HTML as content

I am trying to append to an ordered list based on the JSON response i receive from the server. 我试图根据从服务器收到的JSON响应追加到有序列表。 The response contains HTML tags and for some reason they are not getting rendered in HTML.I did a console.log for the response message and it appears to be fine. 响应包含HTML标记,由于某种原因它们没有以HTML呈现。我为响应消息做了一个console.log,看起来还不错。 However when i append this to my list it does not show on screen. 但是,当我将此添加到我的列表时,它不会显示在屏幕上。

I am using ajax call with jquery and PHP/Mysql in the backend. 我在后端使用jquery和PHP / Mysql的ajax调用。

here is jquery code snippet: 这是jquery代码段:

 success: function (response) {
                    var responsedata = jQuery.parseJSON(response);
                    console.log(responsedata.msg);
                    $('#step3ul2').append("<li>"+responsedata.msg+"</li>");
                    $("#finalmsgsuccessdiv").show();    
                    },

The console.log prints: console.log打印:

<a href = '../editrequest/index.php?q=88>Request id 88</a> was successfully added in the system

however the browser shows nothing. 但是浏览器什么也没显示。

Could it be that the href attribute on the 'a' tag doesn't have the single quote closed? 可能是'a'标记上的href属性没有关闭单引号吗?

<a href = '../editrequest/index.php?q=88>

vs

<a href = '../editrequest/index.php?q=88'>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM