passing index of result to loadEvent funciotn