I'm in this scenario (fighting with the same origin police issue):
I have a map initialized with OpenLayers and a WFS request trough the Protocol.Script object that is giving me this error:
Uncaught TypeError: Object function (a,b){this.metadata={};b=OpenLayers.Util.extend({},b);null!=this.alwaysInRange&&(b.alwaysInRange=this.alwaysInRange);this.addOptions(b);this.name=a;if(null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"),this.div=OpenLayers.Util.createDiv(this.id),this.div.style.width="100%",this.div.style.height="100%",this.div.dir="ltr",this.events=new OpenLayers.Events(this,
this.div),this.eventListeners instanceof Object))this.events.on(this.eventListeners)} has no method 'addOptions'
The error seems to be related with OpenLayers lib (maybe the version, actually is the 2.13), but i don't know.
What i tried is:
consulados = OpenLayers.Layer.Vector("Consulados", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.Script({
url: "http://"+ip+':'+port+"/geoserver/wfs",
callback: 'handleResponse',
params: {
service: "WFS",
version: "1.1.0",
srsName: "EPSG:4326",
request: "GetFeature",
typeName: "topp:tazmania_roads",
outputFormat: "text/javascript"
},
})
});
Any help is appreciated.