Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TypeError: undefined is not an object (evaluating 'cordova.exec.jsToNativeModes.IFRAME_NAV')
- processMessage failed: invalid message: ""
- var ip="xxx.xxx.xxx.xx";
- var port=":4567";
- var authHeader;
- var app={
- Login: function () {
- var username = document.getElementById("username").value;
- var password = document.getElementById("password").value;
- authHeader = cordovaHTTP.getBasicAuthHeader(username, password);
- app.httpPostLogin("/login");
- },
- httpPostLogin: function (route) {
- var url = "http://" + ip + port + route;
- // Send the post request (basically copied from the example on
- // https://github.com/wymsee/cordova-HTTP)
- cordovaHTTP.post(url, null, authHeader,
- function (response) {
- // prints 200
- console.log(response.status);
- try {
- response.data = JSON.parse(response.data);
- // prints test
- console.log(response.data.message);
- } catch (e) {
- console.error("JSON parsing error");
- }
- }, function (response) {
- // prints 403
- console.log(response.status);
- //prints Permission denied
- console.log(response.error);
- });
- },
- }
- macOS High Sierra 10.13.3
- Cordova 7.1.0
- cordova-plugin-http 1.2.0
Add Comment
Please, Sign In to add comment