Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

meleca123

consulta de id

Recommended Posts


não consigo fazer este código funcionar quando clico e enviar ele não mostra o resultado

 

<!DOCTYPE html>

<!--

Licensed to the Apache Software Foundation (ASF) under one

or more contributor license agreements. See the NOTICE file

distributed with this work for additional information

regarding copyright ownership. The ASF licenses this file

to you under the Apache License, Version 2.0 (the

"License"); you may not use this file except in compliance

with the License. You may obtain a copy of the License at

 

http://www.apache.org/licenses/LICENSE-2.0

 

Unless required by applicable law or agreed to in writing,

software distributed under the License is distributed on an

"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

KIND, either express or implied. See the License for the

specific language governing permissions and limitations

under the License.

-->

<html>

<head>

<meta charset="utf-8" />

<meta name="format-detection" content="telephone=no" />

<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->

<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

<meta name="msapplication-tap-highlight" content="no" />

<script type="text/javascript" src="cordova.js"></script>

<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>

<script>

function buscaRegistro(valor) {

 

$.getJSON('http://localhost/android/RespuestaJSON/respuesta.php',{id:valor},function(data){

console.log(JSON.stringify(data));

var datos;

var tr;

for (var i = 0; i < data.length; i++) {

tr = $('<tr/>');

tr.append("<td>" + data.id + "</td>");

tr.append("<td>" + data.uid + "</td>");

tr.append("<td>" + data.username + "</td>");

$('#tabla').append(tr);

}

 

$(data).each(function (index, data) {

$("#Lista").append(

"<li>ID: <strong>"+data.id+"</strong>"+

" ID user: <strong>"+data.uid+"</strong>"+

" Nome: <strong>"+data.username+"</strong>"+"</li>");

});

 

});

}

</script>

<title>JSON</title>

</head>

 

 

 

 

 

 

 

 

 

 

<body onload="init();">

 

<form id="formulario" action="" method="get" >

Nome:<input type=text name="txnome" id="txnome" onblur="buscaRegistro()" size="40"><br><br>

<input type=submit value="OK">

<input type=reset value="Apagar">

</form>

<h1>Malucos teste</h1>

<table id="tabla" border="1px solid black">

<tr>

<th >ID</th>

<th>ID USER</th>

<th>NONE</th>

</tr>

</table>

 

<h1>LISTA</h1>

<div id="Lista">

<ul id="contenedorLista">

</ul>

</div>

 

 

</body>

</html>

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.