Salve seguendo una guida ho creato due file :
index.html :
dati.php:codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>senza nome</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Geany 1.22" /> <script src="jquery.js" type="text/javascript"></scrpt> <script type="text/javascript"> $(document).ready(function() { $("#bottone").click(function(){ var nome = $("#nome").val(); var cognome = $("#cognome").val(); $.post("dati.php", { nome: nome, cognome: cognome }, function(msg){ $("#risultato").html(msg); }) </script> </head>
E nella stessa cartella ho inserito il file :jquery.js che richiamo concodice:<?php $nome = $_POST["nome"]; $cognome = $_POST["cognome"]; if ($nome == "" || $cognome == "") { echo "Inserire nome e cognome!"; } else { echo $nome . " " . $cognome; } ?>
<script src="jquery.js" type="text/javascript"></scrpt>
Perchè non funziona?

Rispondi quotando