From 54f85bdb8fa3a2d8b81bba6f76bc6d648a5d9621 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sun, 10 Feb 2008 20:57:41 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Ajax.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Ajax.js b/lib/OpenLayers/Ajax.js index 8167d0a3c9..4f2e7b9aae 100644 --- a/lib/OpenLayers/Ajax.js +++ b/lib/OpenLayers/Ajax.js @@ -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); },