This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
[ | |
{ | |
"id": 1, | |
"slug": "acrelandia", | |
"city": "Acrelândia", | |
"state": "Acre", | |
"uf": "AC" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @var db Base de dados para backup e restauracao | |
*/ | |
var db = window.openDatabase("CAMINHO DO BANCO", "1.0", "NOME DO BANCO", 5 * 2048); | |
/** | |
* Mostra o erro de arquivo | |
* @param {obj} error Recebe o objeto de erro | |
* @returns {void} | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Access-Control-Allow-Origin: *'); // no cabeçalho | |
$array = array ('test1', 'test2', 'test3'); | |
echo json_encode ($ array); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<title> TESTE AJAX </title> | |
<body> | |
<button>CLIQUE AQUI</button> | |
<div id="teste"> </div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var test1 = 'test1'; | |
var test2 = 'test2'; | |
app.request.get ('pagina.php', { | |
FIELD1: teste1, | |
FIELD2: test2, | |
}, function (data) { | |
JSON.parse (data) // transforms into JSON array | |
console.log (data); // prints on the console the return | |
}) |