jquery - Why doesn't my alert alert or my log log? -
i've got large json file that, if has unexpected entries in various elements, fails. so, rather copy in few "recods" @ time see breaks (it works, time-consuming , tedious), i've tried let me know how far it's getting alerting me progress:
$.getjson('content/pulitzers.json', function (data) { $.each(data, function (i, datapoint) { if (isyear(datapoint.category)) { htmlbuilder += '<div class=\"yearbanner\">' + datapoint.category + '</div>'; alert(datapoint.category); } else {
...and, when didn't work (better idea, anyway), log message:
. . . if (isyear(datapoint.category)) { htmlbuilder += '<div class=\"yearbanner\">' + datapoint.category + '</div>'; console.log(datapoint.category); . . .
...however, work when fed in good, anyway. iow, i'll see "2013" down "2009" if good, when add "records" down 2005, in there problem somewhere, fails without peep or whimper.
how can give me more feedback?
alternatively, there "json validation" site unleash robots on json file czech being well-formed?
you can paste json jsonlint check if it's valid.
using method on serverside converts data valid json avoid such issues part.
also there progress event ajax, won't progress in success handler way you're doing it, , not other way achiveable either.
Comments
Post a Comment