简体   繁体   中英

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. 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. 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.

here is jquery code snippet:

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

The console.log prints:

<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 = '../editrequest/index.php?q=88>

vs

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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