- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
recently I have written a code for an application and that code works correctly using the emulators of INTEL XDK but, when I create the file .apk for my smarthphone and install it, It opens correctly but it doesn't work. For example in the following code I want that when you click on botton appear an "alarm" page and is send a web request. The web page ask an authorization and I use the "xmlhttprequest" function for it. I repeat that it works correctly using emulator but not when I install it on my smarthphone.
Could you help me?
thank you very much
(ps: "url" is the url of my personal webpage that is protected by admin and password)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="jqm/jquery.mobile-min.css">
<title>Blank App Designer Packaged Web App Project Template</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=no">
<style>
@-ms-viewport { width: 100vw ; min-zoom: 100% ; zoom: 100% ; } @viewport { width: 100vw ; min-zoom: 100% zoom: 100% ; }
@-ms-viewport { user-zoom: fixed ; min-zoom: 100% ; } @viewport { user-zoom: fixed ; min-zoom: 100% ; }
</style>
<link rel="stylesheet" href="css/app.css">
<link rel="stylesheet" type="text/css" href="css/index_main.less.css" class="main-less">
<script src="cordova.js" id="xdkJScordova_"></script>
<script src="js/app.js"></script>
<!-- for your event code, see README and file comments for details -->
<script src="js/init-app.js"></script>
<!-- for your init code, see README and file comments for details -->
<script src="xdk/init-dev.js"></script>
<!-- normalizes device and document ready events, see file for details -->
<script type="application/javascript" src="lib/jquery.min.js"></script>
<script type="application/javascript" src="jqm/jquery.mobile-min.js" data-ver="0"></script>
</head>
<body>
<div class="upage vertical-col left" id="mainpage" data-role="page">
<a class="widget uib_w_1 d-margins" data-uib="jquery_mobile/button" data-ver="0" onclick="apertura()" data-role="button" data-theme="a">Button</a>
</div>
<script type="text/javascript">
function apertura(){
var request =XMLHttpRequest();
request.open("GET", "url",false,"admin","password");
request.send(null);
alert('messaggio')
}
</script>
</body>
</html>
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try to use like this:
function apertura(){
$.ajax ({
url: "http://.......",
dataType:"application/json", //o que espero receber
success: function(retorno) {
funPegaTempoRefresh(retorno);
},
error: function (jqXHR,textStatus,errorThrown) {
funAvisaProblema(jqXHR,textStatus,errorThrown)
},
});
}
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page