You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by 友夏 <84...@qq.com> on 2017/04/10 11:48:57 UTC

How to implement post request in Native Android with weex-hackernews example

Hi,
The following code can be run in browser, but has no responce when i packaged it in apk with android mobile phone.
Does axios not support Native Android ?

Thanks

youxia


    import axios from 'axios';
    var querystring = require('querystring');

    ...

    var this_page = this;
    var params = {    username:'username1'};
    var paramsStr = querystring.stringify(params)

    axios.post('https://www.aganinfo.com/ag/dazhai/posttest.do', 
        paramsStr
    )
    .then(function (response) {
        this_page.result = "OK";
    })
    .catch(function (response) {
        this_page.result = "ERR";
    });

Re: How to implement post request in Native Android with weex-hackernews example

Posted by sospartan <so...@apache.org>.
hi,
axios is a 'Promise based HTTP client for the browser and node.js', you can
not use it in weex native. Weex provide stream module do the same thing.
See more here http://weex.apache.org/references/modules/stream.html

On Mon, Apr 10, 2017 at 7:48 PM, 友夏 <84...@qq.com> wrote:

> Hi,
> The following code can be run in browser, but has no responce when i
> packaged it in apk with android mobile phone.
> Does axios not support Native Android ?
>
> Thanks
>
> youxia
>
>
>     import axios from 'axios';
>     var querystring = require('querystring');
>
>     ...
>
>     var this_page = this;
>     var params = {    username:'username1'};
>     var paramsStr = querystring.stringify(params)
>
>     axios.post('https://www.aganinfo.com/ag/dazhai/posttest.do',
>         paramsStr
>     )
>     .then(function (response) {
>         this_page.result = "OK";
>     })
>     .catch(function (response) {
>         this_page.result = "ERR";
>     });




-- 
Best Regards!
------------------------------

sospartan
https://weex-project.io