0

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.

2
  • Are you sure your selectors are correct? What does your HTML look like? Commented Jan 11, 2012 at 3:11
  • Obvious, but just incase, do you have an element with id step3ul2 and finalmsgsuccessdiv ? Commented Jan 11, 2012 at 3:11

1 Answer 1

8

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'>
Sign up to request clarification or add additional context in comments.

3 Comments

yup it seems that the ' was causing the issue....i guess its time to go home..too late :) Thanks a lot!!!
hehe, yeah, sometimes the answer lays in our dreams (or lack of it). Good luck!
seriously man i was thinking may be something is wrong with jquery parsing json...or a bug in my php sending back data etc etc went all the wrong way digging into stuff that made no sense :):) I am a 1 man army building the whole app on my own and don't have a team per se to work with...however i was wrong....i have a huge team and its called the stackoverflow team!!! :):)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.