Guest User

Untitled

a guest
Feb 5th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. TypeError: undefined is not an object (evaluating 'cordova.exec.jsToNativeModes.IFRAME_NAV')
  2.  
  3. processMessage failed: invalid message: ""
  4.  
  5. var ip="xxx.xxx.xxx.xx";
  6. var port=":4567";
  7. var authHeader;
  8. var app={
  9. Login: function () {
  10. var username = document.getElementById("username").value;
  11. var password = document.getElementById("password").value;
  12. authHeader = cordovaHTTP.getBasicAuthHeader(username, password);
  13. app.httpPostLogin("/login");
  14. },
  15.  
  16. httpPostLogin: function (route) {
  17. var url = "http://" + ip + port + route;
  18. // Send the post request (basically copied from the example on
  19. // https://github.com/wymsee/cordova-HTTP)
  20. cordovaHTTP.post(url, null, authHeader,
  21. function (response) {
  22. // prints 200
  23. console.log(response.status);
  24. try {
  25. response.data = JSON.parse(response.data);
  26. // prints test
  27. console.log(response.data.message);
  28. } catch (e) {
  29. console.error("JSON parsing error");
  30. }
  31. }, function (response) {
  32. // prints 403
  33. console.log(response.status);
  34.  
  35. //prints Permission denied
  36. console.log(response.error);
  37. });
  38. },
  39. }
  40.  
  41. macOS High Sierra 10.13.3
  42. Cordova 7.1.0
  43. cordova-plugin-http 1.2.0
Add Comment
Please, Sign In to add comment