2๐
โ
I am not familiar with django but if I am following correctly I think you need to change the following:
$.each( response, function ( i, val ) {
html += "<li>" + val.value + "</li>";
});
val is an object.
Also for just a debugging tip I would add console.log(response);
before the $.each();
in order to figure out what val is going to be if I were to run into a situation like you are in.
๐คdwaddell
2๐
You need to drill into the JSON value, like this:
val.id
val.label
val.value
I assume you want val.label
to be the text for the <li>
, so your code should be this:
$.each( response, function ( i, val ) {
html += "<li>" + val.value + "</li>";
});
๐คKarl Anderson
Source:stackexchange.com