Scusate sto studiando ma non riesco a trovare il problema:
file "test.html"
codice HTML:
<!DOCTYPE html><html> <head> <title>Prova</title> <script type="text/javascript" src="ajax.js"></script> </head> <body> <form name="Test"> <label>Il Tuo Nome</label> <input name="nome"> </form> </body></html>
file "user.php" che include DB
Codice PHP:
include ('db.inc.php'); $sql = "SELECT * FROM Utenti WHERE Id = '1'"; $result = mysql_query($sql); if($row=mysql_fetch_array($result)){ echo $row["Nome"]; } else { echo "0 results"; } mysql_close();
FINO A qui sembra funzionare le lancio la pagina mi scrive il nome a video....
ora cerco di scrivere i dati sul mio html con questo "Ajax.JS"
codice:
$(document).ready(function() {
$.ajax({
url:'user.php',
success: function(data) {
$('input[name="Nome"]').val(data);
}
});
});
mi stampa solo il campo vuoto....dove sbaglio ??
Grazie per la pazienza...