Move ProxyHost addition to Ajax.Request instead of

OpenLayers.loadURL. Makes it easier to write more complex 
apps that require ajax.request stuff without duplication 
of code. r=elemoine (Closes #1350)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6184 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-02-10 20:57:41 +00:00
parent 4d6ccf2e50
commit 54f85bdb8f

View File

@@ -59,10 +59,6 @@ OpenLayers.nullHandler = function(request) {
OpenLayers.loadURL = function(uri, params, caller,
onComplete, onFailure) {
if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(uri, "http")) {
uri = OpenLayers.ProxyHost + encodeURIComponent(uri);
}
var success = (onComplete) ? OpenLayers.Function.bind(onComplete, caller)
: OpenLayers.nullHandler;
@@ -287,6 +283,10 @@ OpenLayers.Ajax.Request = OpenLayers.Class(OpenLayers.Ajax.Base, {
initialize: function(url, options) {
OpenLayers.Ajax.Base.prototype.initialize.apply(this, [options]);
if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(uri, "http")) {
url = OpenLayers.ProxyHost + encodeURIComponent(url);
}
this.transport = OpenLayers.Ajax.getTransport();
this.request(url);
},