Using payments in meteor, and interacting with the server for data

Source: Internet
Author: User

How do I use Meteor.http.call?

Meteor.http is only available on sever side

The HTTP module can only be used on the server side.

1,add http

Meteor Add HTTP

2, asynchronous invocation with Wrapasync encapsulation

Meteor.methods ({    hello:function () {        console.log ("server");        var posttest = function (CB) {            Meteor.http.post ("Http://app.lawxin.com/version",                {data: {},headers: {                    //) Content-type ":" Application/json ",                    " Accept ":" Application/json "                }},                function (error, result) {                    Console.log ("Content", json.stringify (Result));                    CB && CB (Error, result);                });        Return Meteor.wrapasync (Posttest) ();    } ...

  

CB is callback, it must be called. The format of the CB must be the function (Error,result) {} format.

3, BUG: Error whitelist rejection

Mobile-config.js:

App.accessrule (' * ');

  

4,add Cordova Pingxx Plugin

Meteor Add Cordova:[email protected]://github.com/tongchia/cordova-plugin-pingpp/tarball/ b7bdf93a7fbda003a8fab44967bfa5fc36488731

This plugin requires parameters when it is added, so add:

Mobile-config.js:
App.configureplugin (' co.airsia.cordova.pingpp ', {
Url_scheme: ' Meteorionic '
});

5, using Ejson

Meteor Add Ejson

Main methods:

Ejson.parse
Ejson.stringify

6, BUG: Error Charge Object

function (Error,result)

The result returned in the method is in string format.

Using payments in meteor, and interacting with the server for data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.