salve non riesco a far funzionare questa richiesta ajax al server, qui metto il mio codice
sul server:
<?php
//unset($_POST['Email']);
$campo_controllo=$_POST;
include("db.php");
$con=mysqli_connect($server, $db_user, $db_pwd,$db_name) //connect to the database server
or die ("Could not connect to mysql because ".mysqli_error());
mysqli_select_db($con,$db_name) //select the database
or die ("Could not select to mysql because ".mysqli_error());
$query="select * from ".$table_utenti." where email='$campo_controllo'";
$result=mysqli_query($con,$query) or die('error');
$dati = array();
while($row = mysqli_fetch_array($result))
{
$dato = array(
"id_utente" => $row['id_utente'],
"nome" => $row['nome'],
"cognome" => $row['cognome'],
"sesso" => $row['sesso'],
"email" => $row['email'],
);
$dati[] = $dato;
echo json_encode($dati);
?>
funzione ajax:
function utente()
{
alert('sto prendendo id utente');
var service_utente =localStorage.getItem('service_Dati_utente');
alert(service_utente);
var email_utente=sessionStorage.getItem('email_utente' );
$.ajax({
url :service_utente,
type: "POST",
data: {
idAzienda:email_utente
},
dataType: "json",
success:function(data){
var stringa = JSON.stringify(data);
var stringa_json = JSON.parse(stringa);
var json = stringa_json;
var i = 0;
var id_restituito =json[i].id_utente;
var nome_utente=json[i].nome;
var cognome_utente =json[i].cognome;
var sesso_utente =json[i].sesso;
var email =json[i].email;
non mi viene restituito nessun dato!! come posso fare??
potete darmi dei consigli grazie saluti giuseppe;![]()