Provo a postarti qualcosa... in questa prova cercavo di inviare i dati ad una pagina php e farmi restituire un valore su un div presente nella pagina del form.

questo è il file form.html

<html>
<head>
<script type="text/javascript" src="engine.js"></script>
</head>

<script type="text/javascript">
function submit_form() {

var name = document.getElementById('name').value;

url = 'esegui.php?name=' + escape(name) ;

ajax_get (url, 'result');

}
</script>

<body>
div id="result">

</div>



Nome: <input type="text" name="name" id="name" />


<input type="button" onclick="submit_form();" value="Invia" />
</body>
</html>

il file engine.js contiene questi dati:

url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

var ajax_get_error = false;

function ajax_do (url) {

if (url.substring(0, 4) != 'http') {
url = base_url + url;
}

var jsel = document.createElement('SCRIPT');
jsel.type = 'text/javascript';
jsel.src = url;

document.body.appendChild (jsel);

return true;
}

function ajax_get (url, el) {

if (typeof(el) == 'string') {
el = document.getElementById(el);
}

if (el == null) { return false; }

if (url.substring(0, 4) != 'http') {
url = base_url + url;
}

getfile_url = base_url + 'getfile.php?url=' + escape(url) + '&el=' + escape(el.id);

ajax_do (getfile_url);

return true;
}