forked from requirejs/requirejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonp.html
More file actions
45 lines (45 loc) · 1.59 KB
/
jsonp.html
File metadata and controls
45 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<title>require.js: JSONP Test</title>
<script type="text/javascript" src="../../require.js"></script>
<script type="text/javascript" src="../doh/runner.js"></script>
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
<script type="text/javascript">
require({
baseUrl: "./",
paths: {
require: "../../require"
}
},
["require", "lamp", "http://www.google.com/jsapi?callback=define"],
function (require, lamp, googleAjaxReady) {
//JSAPI is now loaded, load the language API pack
google.load("language", "1", {
callback: function () {
//Language API pack now loaded, use it.
google.language.translate("book", "en", "es", function(result) {
doh.register(
"jsonp",
[
function jsonp(t){
t.is("libro", result.translation);
t.is('blue', lamp.color);
}
]
);
doh.run();
});
}
});
}
);
</script>
</head>
<body>
<h1>require.js: JSONP Test</h1>
<p>Test for usage of a JSONP URL as a dependency.</p>
<strong>REQUIRES access to internet/Google to run the test. Otherwise it will fail.</strong>
<p>Check console for messages</p>
</body>
</html>