1
was doing a test to test the phonegap, but I’m not able to make an Ajax request in the app, but the request works in the browser.
$( "#botaoBusca" ).click(function(){
var cep = $( "#cep" ).val();
$.getJSON('https://viacep.com.br/ws/'+cep+'/json/?callback=?', function(data) {
var endereco =
   { rua    : data.logradouro,
     cidade : data.localidade,
     uf     : data.uf
   };
$( "#endereco" ).text("Você mora na "+endereco.rua+", "+endereco.cidade+" - "+endereco.uf);
});
});
HTML:
</head>
 <body>
   <div class="container text-center">
   <div class="row">
    <h1>Olá, AJAX</h1>
            <label>Digite o seu cep:</label>   
            <input id="cep" type="text" pattern="\d{8}" maxlength="8"><br>
            <button class="btn btn-primary" id="botaoBusca" type="button">Buscar</button>    
            <h3 id="endereco"></h3>
        </div>
    </div>    
    <script src="js/jquery-1.12.2.min.js"></script>
    <script src="js/jquery.mobile-1.4.5.min.js"></script>
    <script src="js/ajax.js"></script>
</body>
Thank you
By default, Phonegap has a "block" to access web pages by the app. But for those who need this access, he has in his own documentation a guide explaining how to solve it. Follow the link: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/#supported-Cordova-Platforms
– Joao Victor Pereira santos