missing event when using modules with requirejs
Posted
by
ali haider
on Stack Overflow
See other posts from Stack Overflow
or by ali haider
Published on 2014-05-20T19:53:39Z
Indexed on
2014/05/27
15:26 UTC
Read the original article
Hit count: 418
JavaScript
|requirejs
I had javascript code in a single JS file that was working fine (using XHR/AJAX). When I split it up into separate modules in a requirejs application, I do not seem to get a handle on the event object & it shows up as undefined (testing in firefox 29.0.1).
Calling module:
ajax.onreadystatechange = new ajaxResponse().handleAjaxResponse(e);
ajaxResponse
define(["require", './url/urlCommon'], function(require, urlCommon) {
'use strict';
var ajaxResponse = function() {
var ajax = null;
// e = event || window.event;
this.handleAjaxResponse = function() {
if (typeof event === 'undefined') {
var event = event || window.event;
}
console.log('e is now:' + typeof e);
I also do not have a handle on the event in the handleAjaxResponse method (error: undefined). Any thoughts on what I need to do to troubleshoot/fix this will be greatly appreciated.
© Stack Overflow or respective owner