AJAX Post 数据示例问题

发布于 2024-11-19 03:14:31 字数 1611 浏览 2 评论 0原文

我不知道这是错误还是我的错,但我不明白。

如果您是 AJAX 专家,那么您也许无需 ENYO 知识就能回答这个问题。

在 ENYO 的 DATA 示例中,您可以看到 AJAXGET 和 AJAXPOST 方法。

  1. 这两种方法都可以在模拟器中工作,但不能在 Crome 中工作(这是跨浏览器问题吗?)
  2. 并且在 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.

  1. Both of this method is working in Emulator but not in Crome (Is that crossbrowser Prob?)
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枕头说它不想醒 2024-11-26 03:14:31

您也在 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文