Hi Tishan, Thanks a lot for your reply, I will sure try that out. and I will report the documentation issue on JIRA as well.
Regards, Jerad On Fri, Aug 29, 2014 at 5:41 PM, Tishan Dahanayakage <[email protected]> wrote: > Hi Jerad, > Does your end point URL has a service to serve your HTTP post? Since > Jaggery post is a wrapper for XMLHTTPRequest post as per jaggery > documentation, make sure your URL (http://localhost:8280/) can handle > your post and return a response. > And I think your JSON data does not need apostrophe at beginning and end. > Also please note that in this particular request you are setting HTTP > headers. (var res = post(url,[ data],[ headers],[ type])) > For the issue of documentation try out not working please raise a JIRA at > [1]. > > [1] https://wso2.org/jira/browse/JAGGERY > > > On Thu, Aug 28, 2014 at 5:19 PM, Jerad Rutnam <[email protected]> wrote: > >> Hi Milinda, >> >> Thanks for the reply. Yes, I too noticed that. I think we better get this >> fix right? I'm not sure whom to inform. :) >> Anyway my actual requirement is to post() a json string with an array to >> esb and get the response. Here is the code I used. But it throws an >> exception. Any idea where I did wrong? Help will be appreciate. >> >> <% >> >> var url = 'http://localhost:8280/'; >> var result = post(url, 'Jaggery HTTP POST', {'"newbies" : >> [{"name":"Dinesh"}, {"name":"Dilan"}, {"name":"Jerad"}]'}, >> 'application/json'); >> print(result.data); >> >> %> >> >> >> Thanks, >> Jerad >> >> >> On Thu, Aug 28, 2014 at 4:12 PM, Milinda Perera <[email protected]> >> wrote: >> >>> Hi, >>> >>> Seems 'http://jaggeryjs.org/apidocs/resources/data.jag' resource is not >>> available. >>> >>> Thanks, >>> Milinda >>> >>> >>> >>> >>> On Thu, Aug 28, 2014 at 3:39 PM, Jerad Rutnam <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> Tried to use Jaggery post() method. And it's not working as expected. >>>> getting an error on the documentation try out feature. >>>> >>>> >>>> *Sample* >>>> <% >>>> var url = 'http://jaggeryjs.org/apidocs/resources/data.jag'; >>>> var result = post(url, 'Jaggery HTTP POST', { >>>> "User-Agent" : "Jaggery-XHR", >>>> "Country" : "LK" >>>> }, 'json'); >>>> print(result.data); >>>> %> >>>> >>>> *On the local jaggery server* >>>> *com.google.gson.JsonSyntaxException: >>>> com.google.gson.stream.MalformedJsonException: Expected EOF at line 1 >>>> column 27 at line #3* >>>> >>>> * On the "jaggeryjs.org <http://jaggeryjs.org>" **website* >>>> *org.jaggeryjs.scriptengine.exceptions.ScriptException: >>>> java.net.ConnectException: Connection timed out at line #3* >>>> >>>> *http://jaggeryjs.org/documentation.jag?api=post >>>> <http://jaggeryjs.org/documentation.jag?api=post>* >>>> >>>> >>>> Any feedback appreciate >>>> >>>> *Regards,* >>>> >>>> *Jerad* >>>> >>>> -- >>>> *Jerad Rutnam | **Software Engineer - UI* >>>> WSO2, Inc. www.wso2.com >>>> >>>> *Email: [email protected] <[email protected]>* >>>> >>>> _______________________________________________ >>>> Dev mailing list >>>> [email protected] >>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>> >>>> >>> >>> >>> -- >>> Milinda Perera >>> Software Engineer; >>> WSO2 Inc. http://wso2.com , >>> Mobile: (+94) 714 115 032 >>> >>> >> >> >> -- >> *Jerad Rutnam | **Software Engineer - UI* >> WSO2, Inc. www.wso2.com >> >> *Email: [email protected] <[email protected]>* >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Tishan Dahanayakage > Software Engineer > WSO2, Inc. > Mobile:+94 716481328 > > Disclaimer: This communication may contain privileged or other > confidential information and is intended exclusively for the addressee/s. > If you are not the intended recipient/s, or believe that you may have > received this communication in error, please reply to the sender indicating > that fact and delete the copy you received and in addition, you should not > print, copy, re-transmit, disseminate, or otherwise use the information > contained in this communication. Internet communications cannot be > guaranteed to be timely, secure, error or virus-free. The sender does not > accept liability for any errors or omissions. > -- *Jerad Rutnam | **Software Engineer - UI* WSO2, Inc. www.wso2.com *Email: [email protected] <[email protected]>*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
