request.js 489 B

12345678910111213141516171819202122
  1. Page({
  2. requestHttp() {
  3. my.httpRequest({
  4. url: 'http://httpbin.org/post',
  5. method: 'POST',
  6. data: {
  7. from: '支付宝',
  8. production: 'AlipayJSAPI',
  9. },
  10. dataType: 'json',
  11. success: function(res) {
  12. my.alert({content: JSON.stringify(res)});
  13. },
  14. fail: function(res) {
  15. my.alert({content: JSON.stringify(res)});
  16. },
  17. complete: function(res) {
  18. // my.alert({title: 'complete'});
  19. }
  20. });
  21. }
  22. })