@@ -15,6 +15,69 @@ To run the code, cd to the directory where you checked out the code and type
15
15
16
16
node server.js
17
17
18
+
19
+ API
20
+ ---
21
+
22
+ There are currently two commands:
23
+
24
+ ###xml2jsonp - Convert an xml document to JSONP
25
+
26
+ ####Example with CURL
27
+ curl "http://your.node.installation.here/xml2jsonp?url=http://www.example.com/rss.xml&callback=myCallback "
28
+
29
+ ####Example with HTML and jQuery
30
+ <! DOCTYPE html>
31
+ <html >
32
+ <head >
33
+ <script type =" text/javascript " src =" http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js " ></script >
34
+ <script type =" text/javascript " >
35
+
36
+ // This is the example XML file..
37
+ var url = "http://www.example.com/rss.xml";
38
+
39
+ $("document").ready(function() {
40
+ $.getJSON(
41
+ "http://your.node.installation.here/xml2jsonp?callback=?&url=" + url,
42
+ function(data) {
43
+ alert(JSON.stringify(data, null, 4));
44
+ }
45
+ );
46
+ });
47
+ </script>
48
+ </head>
49
+ <body>
50
+ </body>
51
+ </html>
52
+
53
+ ###jsonjsonp - Convert a JSON document to JSONP (handy for getting around cross-domain restrictions)
54
+
55
+ ####Example with CURL
56
+ curl "http://your.node.installation.here/json2jsonp?url=http://www.example.com/doc.json&callback=myCallback "
57
+
58
+ ####Example with HTML and jQuery
59
+ <! DOCTYPE html>
60
+ <html >
61
+ <head >
62
+ <script type =" text/javascript " src =" http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js " ></script >
63
+ <script type =" text/javascript " >
64
+
65
+ // This is the example JSON file..
66
+ var url = "http://www.example.com/doc.json";
67
+
68
+ $("document").ready(function() {
69
+ $.getJSON(
70
+ "http://your.node.installation.here/json2jsonp?callback=?&url=" + url,
71
+ function(data) {
72
+ alert(JSON.stringify(data, null, 4));
73
+ }
74
+ );
75
+ });
76
+ </script>
77
+ </head>
78
+ <body>
79
+ </body>
80
+ </html>
18
81
Licence
19
82
-------
20
83
0 commit comments