Link to home
Start Free TrialLog in
Avatar of WorknHardr
WorknHardr

asked on

AJAX responseText Each Value Append UL?

Q. How do I return this ajax responseText into a ul li ?

Here's what I have so far, pretty close...

{"readyState":4,"responseText":"[\"value1\",\"value2\"]","responseJSON":["value1","value2"],"status":200,"statusText":"OK"}

 <ul id="list"></ul>

$.ajax ...
          ,complete: function (response) 
                             {
                                    var array = jQuery.parseJSON(response.responseText);

                                    alert(array); // Value1,Value2

                                    $.each(array.split(','), function(item)
                                    {
                                         $('#list').append('<li>' + item  + '</li>');
                                    });

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WorknHardr
WorknHardr

ASKER

Excellent, it was late last night and couldn't get it, thanks...
You are welcome - thanks for the points.