Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Página de teste</title>
- <link rel="stylesheet" href="css/jquery.mobile.icons.min.css" />
- <link rel="stylesheet" href="css/jquery.mobile.structure-1.4.2.min.css" />
- <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="js/jquery.mobile-1.4.2.min.js"></script>
- <script type="text/javascript" src="js/functions.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- event.preventDefault();
- var db;
- db = openDatabase(
- 'BASE',
- '1.0',
- 'BASE Teste',
- 1 * 1024 * 1024
- );
- db.readTransaction(
- function(transaction) {
- transaction.executeSql("SELECT COUNT(1) as total, codigo FROM table1;", [], OkRetorno1, ErroRetorno);
- }
- );
- db.readTransaction(
- function(transaction) {
- transaction.executeSql("SELECT estado,nome FROM table1 ORDER BY voto;", [], OkRetorno, ErroRetorno);
- }
- );
- function OkRetorno1(transaction, results) {
- $("#total").css("display", "inline");
- var row = results.rows.item(0);
- total1.innerHTML = row['total'];
- }
- function OkRetorno(tx,results) {
- if (results.rows.length) {
- for (i=0;i<results.rows.length;i++) {
- var row = results.rows.item(i);
- console.log(i + ' - ' + row['nome']);
- resultado1.innerhtml = row + 1;
- dataString = 'estado=' + row['estado'] + '&nome=' + row['nome'];
- $.ajax({
- url : 'http://url_do_webservice/webservice.php',
- type : 'POST',
- async: false,
- data: dataString ,
- sucess: function () {
- resultado1.innerhtml = row + 1; },
- error: function(xhr, ajaxOptions, thrownError){
- alert('AJAX = ' + xhr.status + ' - ' + thrownError);
- }
- });
- }
- }
- carregar.innerHTML = 'Concluído.' ;
- $("#finalizar").css("display", "inline");
- }
- });
- </script>
- </head>
- <body>
- <div data-role="page" data-theme="a">
- <div data-role="content" style="text-align:center">
- <div id="carregar" style="font-size:22px;font-weight:bold;color:#f1fe01">
- Aguarde !!! Carregando Nomes ...
- </div>
- <br />
- <br />
- <div id="total" style="font-size:18px;font-weight:bold;color:ffffff">
- Nomes do Estado: <span id="resultado1">0</span> / <span id="total1">0</span>
- </div>
- <br />
- <br />
- <div id="finalizar" style="display:none;margin-top:35px">
- <a href="comeco.html" data-ajax="false" data-role="button" data-icon="check" data-inline="true">OK</a>
- </div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement