javascript - Ajax call returning a Uncaught TypeError when deployed to Heroku -
i have rails project i'm making couple of requests through ajax. when run locally, request comes me , i'm able parse through data , append view page. however, when pushed heroku, doesn't work , following error:
uncaught typeerror: cannot read property 'stops' of null
the line error referencing first ajax call. when run locally returns data me (no errors @ when have console open , view it), not sure why wouldn't work once deployed. guess it's assuming value 'stops' has finished (which seems locally), on heroku it's using before returned. i'm not sure why. hoping might have idea why happening.
i know view recognizing javascript page - threw alert message make sure firing , worked. not else involves ajax calls (although might first ajax call that's causing issue).
below if ajax request if helps:
// code above $.ajax({ type: "get", datatype: "jsonp", url: response, data: {}, success: function(result){ var stopobjects = array.prototype.slice.call(result.data.stops); requeststopdata(stopobjects); } }); // code below
thanks, appreciate , suggestions.
edit: thought should mention part of request's url requires latitude , longitude coordinates using html's geolocation (not sure if cause issue, wanted mention it). thanks.
Comments
Post a Comment