ciao gente.
ho fatto qualche prova nella speranza di iniziare a tirare fuori qualcosa di più concreto.
al momento non funziona nulla, ma almeno sto provando a buttar giu due righe di codice.
index.php
Codice PHP:
<?php
require_once('conn.inc.php');
require_once('funzioni.inc.php');
if (isset($_GET['__user'])){
echo "eseguito ajax";
}
?>
<html>
<head>
<script language="javascript" src="ajax.js"></script>
<script language="javascript" src="md5.js"></script>
</head>
<body>
<form name="login" method="POST" action="index.php?__submit">
UN: <input type="text" name="user" onkeypress="getNewHTTPObject()" /><br />
PW: <input type="password" name="pword" /><br />
<input type="submit" value="Entra" />
</form>
</body>
</html>
ajax.js
Codice:
function getNewHTTPObject()
{
var xmlhttp;
/** Special IE only code ... */
/*@cc_on
@if (@_jscript_version >= 5)
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E)
{
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
/** Every other browser on the planet */
if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
try
{
xmlhttp = new XMLHttpRequest();
}
catch (e)
{
xmlhttp = false;
}
}
return xmlhttp;
}
var xmlHttp = getHTTPObject();
function getDynamicData()
{
var url = "index.php?__user";
xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = callbackFunction;
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send(null);
}
var syndLinkRequest = getNewHTTPObject();
function callbackFunction()
{
if (syndLinkRequest.readyState != 4)
return;
var result = xmlHttp.responseText;
}
perchè se inizio a scrivere nel campo user, nel form login, non succede nulla e non appare l'echo "eseguito ajax"?