ReferenceError: event is not defined

event is only a global on IE and browsers that choose to emulate it. With standard browsers, event is an argument passed to your event handler. You haven’t shown how you’re hooking up status_post_comment, but where you’re doing that, you’ll want to ensure you pass along the event argument.

For instance, if you were hooking it up via on("click", ...), you might use ES5’s Function#bind (which can be shimmed for older browsers):

someElement.on("click", status_post_comment.bind(null, id));

…and update status_post_comment to accept event:

function status_post_comment(id, event)

(id comes first because we bound it, then the arguments given to the bound function follow it.)

Leave a Comment