NODJSでシンプルなWebセブラーを作成しました。 http://localhost:8888/
に接続すると、Webブラウザie firfoxはhellow worldを表示します。しかし、enyon WebサービスonSuccessコールバックは、inResponseからヌル文字列を表示します。私は静的なWebページを作成し、それをローカルのハイパーサーバサーバーから正常にロードしました。どうしてwanna enyoは常にnodejsから送信されたものからw nullを表示するのですか?NODEJSとenyoをフロントエンドとして使用してWebサービスを作成しようとしています
Webサーバ
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
私はあなたがボタンを押したときに、それがWebサービスを行い、警告ボックスに結果
enyo.kind({
name: "MyApps.MainApp",
kind: enyo.VFlexBox,
// comment code to load in data gfrom service
components: [
{name: "getName", kind: "WebService",
onSuccess: "gotName",
onFailure: "gotNameFailure",
url: "http://localhost:8888/"
},
{kind: "PageHeader", content: "Enyo FeedReader"},
{name:"curValue", content:("Sample Text")},
{kind: "Button", caption: "Action", onclick: "btnClick"} ],
// functions go here
create: function()
{
// call the default creat then do our stuff
this.inherited(arguments);
this.$.getName.call();
},
// Show output of server,
gotName: function(inSender, inResponse) {
this.$.button.setCaption("Success");
alert(inResponse);
},
// go here if it cold not connect to server
gotNameFailure: function(inSender, inResponse) {
this.$.button.setCaption("Failure"); },
// call the server
btnClick: function() {
this.$.getName.call(); }
});
テッド
はまだ動作しません、リンクいただきありがとうございますが、ウェブブラウザ上の領事はAを示し"XMLHttpRequestはhttp:// localhost:3000 /。を読み込めません。http:// localhost:81はAccess-Control-Allow-Originによって許可されていません。任意の理想? –