Search code examples
javascriptajaxjqueryjsbin

making ajax work on JSBIN


I'm trying to get ajax to work in JSBIN like demonstrated in this video. What have I don't wrong. Seems like it ought to work!

$(document).ready(function(){
  $.ajax({
    type: "get",
    url: "http://jsbin.com/ipefom/1/js",
    dataType: "json",
    success: function(returnedData){
      console.log(returnedData)
    }
  });
});

http://jsbin.com/ocerag/3/edit

I don't understand where my parseerror comes from.


Solution

  • Your json is invalid:-

    There is as edit:8 in json which is misplaced and also you have duplicate keys while the number is repeated again. Seems like the same set was copy pasted again.

    "968":"a","969":"a","970":"a","971":"a","972":"a","973":"a","974":"a","975":"a","976":"a","977":"a","978":"a","979":"a","980":"a","981":"a","982":"a","983":"a","984":"a","985":"a","986":"a","987":"a","988":"a","989":"a","990":"a","991":"a","992":"a","993":"a","994":"a","995":"a","996":"a","997":"a","998":"a","999":"a"} edit:8 
    {"0":"a","1":"a","2":"a","3":"a","4":"a","5":"a","6":"a","7":"a","8":"a","9":"a","10":"a","11":"a","12":"a","13":"a","14":"a","15":"a","16":"a","17":"a","18":"a","19":"a","20":"a","21":"a","2