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:
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user