0

I have a drop down list and I want to fill it with data from server in the form of json. So i found this link and tried to implement it in my code. But i get the following error in chrome.

Uncaught Error: NotFoundError: DOM Exception 8

Worse firefox doesn't show any error but the list is not populated at all. Any idea??

I have added the code here

http://jsfiddle.net/alula/77Mtz/

Community
  • 1
  • 1
altsyset
  • 339
  • 2
  • 20

1 Answers1

0

This error mean that you are passing an array to your appending function. You see, version before jq1.8 can't have an array as parameter for any append function and throw this error:

NotFoundError: DOM Exception 8

http://jsfiddle.net/6tW7W/

Upgrading to the newest jQuery (which would be the best move) is your solution :

http://jsfiddle.net/6tW7W/1/

But if you don't want to upgrade, you have to use a loop :

$.each(arr, function(i, v){
    $('body').append(v)
})

http://jsfiddle.net/6tW7W/2/

Karl-André Gagnon
  • 33,662
  • 5
  • 50
  • 75