I cannot make working Framework7.request(…) in emulator neither in phone, while it works in dev mode in browser.
Version: [email protected]
In routes.js I try to get some data from a remote URL and use it in the target page:
var routes = [
(...)
{
path: '/display-detail/:itemId/',
async: function ({ router, to, resolve }) {
(...)
Framework7.request({
url: 'http://my-remote-page:8080/item/detail/'+itemId,
timeout: 5000,
async: true,
method: 'GET',
success: function (data,status,xhr) {
console.log('received: ' + data);
resolve ({component: TargetPage}, {props:{detail:data}});
},
error: function (xhr, status, msg) {
console.log('request failed: ' + status
+ ', xhr: ' + xhr
+ ', status: ' + xhr.status
+ ', statusText: ' + xhr.statusText
+ ', readyState: ' + xhr.readyState
+ ', responseText: ' + xhr.responseText
+ ', msg: ' + msg
);
}
});
(...)
}
}
]
It works like a charm in dev mode in my browser.
But in emulator the request is not sent, xhr status is 0, readyState 4, empty message, no clue to find the cause
It might be related to this older forum subject, but in my case with XHttpRequest I’m facing the same scenario, i.e. it fails in emulator:
Error message in console:
“NetworkError: Failed to execute ‘send’ on ‘XMLHttpRequest’”
Whitelist in cordova plugin is set to “*” thus it doesn’t help ([SOLVED] App.request problem - #6 by neworld)
I appreciate any tip/advice !