OpenLayers OpenLayers

root/trunk/openlayers/tests/Ajax.html

Revision 7335, 0.9 kB (checked in by tschaub, 6 months ago)

Adding cross-browser XMLHttpRequest functionality and convenience methods around it in the OpenLayers.Request namespace. Deprecating OpenLayers.Ajax.Request. Full support sync/async requests using all HTTP verbs now. r=elemoine (closes #1565)

  • Property svn:eol-style set to native
Line 
1 <html>
2 <head>
3   <script src="../lib/OpenLayers.js"></script>
4   <script type="text/javascript">
5
6     function test_Ajax_loadUrl(t) {
7         t.plan(5);
8         var _get = OpenLayers.Request.GET;
9         var caller = {};
10         var onComplete = function() {};
11         var onFailure = function() {};
12         var params = {};
13         OpenLayers.Request.GET = function(config) {
14             t.eq(config.url, "http://example.com/?format=image+kml", "correct url")
15             t.eq(config.params, params, "correct params");
16             t.eq(config.scope, caller, "correct scope");
17             t.ok(config.success === onComplete, "correct success callback");
18             t.ok(config.failure === onFailure, "correct failure callback");
19         };
20         OpenLayers.loadURL("http://example.com/?format=image+kml", params, caller, onComplete, onFailure);
21         OpenLayers.Request.GET = _get;
22     }
23   </script>
24 </head>
25 <body>
26 </body>
27 </html>
Note: See TracBrowser for help on using the browser.