javascript - IE ajax parsing / .includes() & .indexOf -
how can write , make work in ie?
var tevents = eventsjson.response.events.filter(function (val, index, array) { return val.participating_region.includes(varregion); }); totalevents = tevents.length;
i know issue .includes() , not sure how write using .indexof()
full code:
var varregion = $('body').data('region'); var eventsjson = null; var totalevents; var virtualevents; $.ajax({ 'url': '/services/getallevents', 'datatype': 'json', 'success': function (data) { eventsjson = data; parsejsonevents(); } }); function parsejsonevents() { var tevents = eventsjson.response.events.filter(function (val, index, array) { return val.participating_region.includes(varregion); }); totalevents = tevents.length; $('.in-person-events').text(totalevents); return eventsjson; };
return val.participating_region.indexof(varregion) > -1;
though hard tell without seeing relevant code , json response structure.
Comments
Post a Comment