AJAX Post 数据示例问题
我不知道这是错误还是我的错,但我不明白。
如果您是 AJAX 专家,那么您也许无需 ENYO 知识就能回答这个问题。
在 ENYO 的 DATA 示例中,您可以看到 AJAXGET 和 AJAXPOST 方法。
- 这两种方法都可以在模拟器中工作,但不能在 Crome 中工作(这是跨浏览器问题吗?)
并且在 AJAXPOST ex 中。数据
var postdata='fname=enda&lname=mcgrath';
单击“发送帖子”按钮后,已发布的内容未显示在结果中。
/* Copyright 2009-2011 Hewlett-Packard Development Company, L.P. All rights reserved. */
enyo.kind({
name: "network.AJAXPost",
kind: HeaderView,
components: [
{name: "postButton", kind: "Button", caption: "Send Post", onclick: "sendPost"},
{name: "postResponse", kind: "HtmlContent", allowHtml: "true"},
{name: "post", kind: "WebService",
url: "http://www.snee.com/xml/crud/posttest.cgi",
method: "POST",
onSuccess: "onSuccess",
onFailure: "onFailure"}
],
sendPost: function() {
var postdata='fname=enda&lname=mcgrath';
this.$.post.call({
handleAs: "text",
postBody: postdata,
contentType: 'application/x-www-form-urlencoded'
});
},
onSuccess: function(inSender, inResponse) {
this.$.postResponse.setContent(inResponse);
console.log("success response = " + inResponse);
},
onFailure: function(inSender, inResponse) {
this.$.postResponse.setContent(inResponse);
console.log("failure response = " + inResponse);
},
});
在这段代码中,如果我替换这一行,
url: "http://www.snee.com/xml/crud/gettest.cgi?fname=enda&lname=mcgrath",
它就可以工作。 你能明白为什么不能使用 postdata 吗? 为什么浏览器不显示发布的数据?
I don't know whether this is bug or my fault but I don't get this.
If you are an AJAX expert then you may be able to answer this question without ENYO knowledge.
in DATA Example of ENYO you can see AJAXGET and AJAXPOST method.
- Both of this method is working in Emulator but not in Crome (Is that crossbrowser Prob?)
And in AJAXPOST ex. the data
var postdata='fname=enda&lname=mcgrath';
is posted is not showing on result after click in Send Post Button.
/* Copyright 2009-2011 Hewlett-Packard Development Company, L.P. All rights reserved. */
enyo.kind({
name: "network.AJAXPost",
kind: HeaderView,
components: [
{name: "postButton", kind: "Button", caption: "Send Post", onclick: "sendPost"},
{name: "postResponse", kind: "HtmlContent", allowHtml: "true"},
{name: "post", kind: "WebService",
url: "http://www.snee.com/xml/crud/posttest.cgi",
method: "POST",
onSuccess: "onSuccess",
onFailure: "onFailure"}
],
sendPost: function() {
var postdata='fname=enda&lname=mcgrath';
this.$.post.call({
handleAs: "text",
postBody: postdata,
contentType: 'application/x-www-form-urlencoded'
});
},
onSuccess: function(inSender, inResponse) {
this.$.postResponse.setContent(inResponse);
console.log("success response = " + inResponse);
},
onFailure: function(inSender, inResponse) {
this.$.postResponse.setContent(inResponse);
console.log("failure response = " + inResponse);
},
});
in this code if i replace this line
url: "http://www.snee.com/xml/crud/gettest.cgi?fname=enda&lname=mcgrath",
it works.
can you got this why not working postdata ?
Why browser not showing posted data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您也在 palm 开发者论坛上发布了此内容 - 但我认为您需要研究“已发布的属性”。
您需要发布 URL,并在发起呼叫之前更改该 URL。全部解释如下:
https://developer.palm.com /content/api/dev-guide/enyo/web-service.html
You posted this on the palm developer forums also - but I think you need to look into "published properties".
You need to publish the URL, and change this before you initiate your call. All explained here:
https://developer.palm.com/content/api/dev-guide/enyo/web-service.html