Last active
December 11, 2015 21:39
-
-
Save worldofchris/4664281 to your computer and use it in GitHub Desktop.
Having a problem using dojo/request under node.js arnosgrove:example chris$ node useRequest.js I can call dojo/date functions no problem:
e.g. Time Zone is:GMT
But when I try to use dojo/request it fails: module.js:236 var start = request.substring(0, 2); ^
TypeError: Object has no method 'substring' at Function.Module._resolveLookupPaths (modul…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dojo-release-1.8.3-src is installed in the same directory as this script | |
dojoConfig = { | |
baseUrl: ".", | |
packages:[{name: 'dojo', location: 'dojo'}], | |
deps:['dojo/request', 'dojo/date'] | |
}; | |
require('./dojo/dojo.js'); | |
console.log("I can call dojo/date functions no problem:"); | |
console.log("e.g. Time Zone is:" + dojo.date.getTimezoneName(new Date())); | |
console.log("But when I try to use dojo/request it fails:"); | |
// Following taken from: | |
// http://dojotoolkit.org/documentation/tutorials/1.8/ajax/ | |
require(["dojo/request"], function(request){ | |
request("helloworld.txt").then( | |
function(text){ | |
console.log("The file's contents is: " + text); | |
}, | |
function(error){ | |
console.log("An error occurred: " + error); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment