Answer the question
In order to leave comments, you need to log in
phonegap + ajax Request not sent. Can anyone help?
A get request is not sent from the application. Locally everything is fine. After compilation, refuses to work. Who faced, I will be grateful if prompt.
index.html
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tele2 Quest App</title>
<link rel="stylesheet" href="js/jquery.mobile-1.4.5.min.css" />
<link rel="stylesheet" href="index.css" />
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).bind('mobileinit',function(){
$.mobile.allowCrossDomainPages = true;
$.support.cors = true;
});
</script>
</head>
<body>
<div data-role="page" class="first" id="first">
<div data-role="content">
<a href="#ask" class="start-btn"></a>
</div>
</div>
<div data-role="page" class="second" id="ask">
<div data-role="content">
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="mark5"></label>
<input type="radio" value="5" name="answer" id="mark5" />
<label for="mark4"></label>
<input type="radio" value="4" name="answer" id="mark4" />
<label for="mark3"></label>
<input type="radio" value="3" name="answer" id="mark3" />
<label for="mark2"></label>
<input type="radio" value="2" name="answer" id="mark2" checked="checked" />
</div>
<a href="#" class="sending"></a>
</div>
</div>
</div>
<div data-role="page" class="end" id="end">
<div data-role="content">
<a href="#first" class="end-btn"></a>
</div>
</div>
<script>
$(document).ready(function(){
$(".sending").click(function(){
param = "";
param = $(".ui-radio-on").attr("for");
param = param.replace("mark", "");
$.ajax({
url: "http://tele2.4sol.pro/api/",
type: "GET",
beforeSend : function() {$.mobile.loading('show')},
complete : function() {$.mobile.loading('hide')},
data: {"data": param, "token": "73b8ef6c67ed9af3e8894d67d98e222a"},
dataType: "json",
crossDomain: true,
cache: false,
success: function(data){
$.mobile.changePage("#end");
},
error: function(){
$.mobile.changePage("#end");
}
});
});
});
</script>
</body>
</html>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="solution.tele_dva.quest" version="1.0.0">
<name>Tele2QuestApp</name>
<description>Tele2 Quest Application</description>
<content src="index.html"/>
<preference name="permissions" value="none"/>
<preference name="orientation" value="landscape"/>
<preference name="target-device" value="universal"/>
<preference name="fullscreen" value="true"/>
<preference name="webviewbounce" value="true"/>
<preference name="prerendered-icon" value="true"/>
<preference name="stay-in-webview" value="false"/>
<preference name="ios-statusbarstyle" value="black-opaque"/>
<preference name="detect-data-types" value="true"/>
<preference name="exit-on-suspend" value="false"/>
<preference name="show-splash-screen-spinner" value="true"/>
<preference name="auto-hide-splash-screen" value="true"/>
<preference name="disable-cursor" value="false"/>
<preference name="android-minSdkVersion" value="14"/>
<preference name="android-installLocation" value="auto"/>
<gap:plugin name="org.apache.cordova.console"/>
<gap:plugin name="org.apache.cordova.device"/>
<gap:plugin name="org.apache.cordova.device-motion"/>
<gap:plugin name="org.apache.cordova.device-orientation"/>
<gap:plugin name="org.apache.cordova.dialogs"/>
<gap:plugin name="org.apache.cordova.file"/>
<gap:plugin name="org.apache.cordova.globalization"/>
<gap:plugin name="org.apache.cordova.media"/>
<gap:plugin name="org.apache.cordova.network-information"/>
<gap:plugin name="org.apache.cordova.splashscreen"/>
<icon src="icon.jpg"/>
<access origin="*" />
<plugin name="cordova-plugin-whitelist" version="1"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<platform name="android">
<allow-intent href="market:*"/>
</platform>
</widget>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question