Problems with my enyo app

edited May 2012 in Enyo 2
Im new to enyo programming (and web apps in general). I'm trying to get a JSON response from a website. for example, this url, give a JSON response (please be aware the demo08 part changes a lot)^priority=1

The application requires authentication, in this case username: admin, password: admin, before it responds.

Would enyo.Ajax be the right route to send the request and receive the JSON response? I have tried using ajax, but I get nothing in the variable inResponse:
requestIncident: function() {
		//var uName = this.$.userName.hasNode().value;
		//var pWord = this.$.passWord.hasNode().value;
		//alert("Username & password: "+uName+" & "+pWord);
		var request = new enyo.Ajax({url: "^priority=2", handleAs: "json", username: "admin", password: "admin"});
		request.response(enyo.bind(this, "processSearchResults"));
		request.error(this, function(inSender,inValue) {
			alert("Error has occurred: "+inValue);
processSearchResults: function(inRequest, inResponse) {
		if(!inResponse) { 
			this.$.jResponse.setContent("the inResponse value is empty :(");
		enyo.forEach(inResponse.results, this.addIncident, this);
Any help would be greatly appreciated.


  • edited May 2012
    Ajax technologies in browsers have security restrictions about making requests to different servers.

    There is an overview here:

    In a nutshell, the solution is generally one of these:

    * use CORS, when the server supports it
    * use JSONP, when the server supports it
    * use a proxy on your server
Sign In or Register to comment.