Search code examples
ajaxjquerywebosenyo

AJAX Post Data Example problem


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?


Solution

  • 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