Eccolo qui sotto, ma non penso che servirà.
Il mio problema è solo su ldocument.nomeForm.submit() che non mi reindirizza alla pagina specificata in action.
Tutto funziona passando le variabili con GET.
Voglio solo che l'invio avvenga con POST.
Codice PHP:
function setPortrait(id){
var ajaxReq; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxReq = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
}
}
}
// Create a function that will receive data sent from the server
ajaxReq.onreadystatechange = function(){
if(ajaxReq.readyState == 4){
document.getElementById('portrait-content').innerHTML = ajaxReq.responseText;
}
}
var user = document.getElementById('username').value;
var querystring = "id=" + id + "&user=" + user;
ajaxReq.open("POST", "./components/com_artmanager/views/artmanager/tmpl/getPortrait.php", true);
ajaxReq.setRequestHeader("content-type", "application/x-www-form-urlencoded");
ajaxReq.send(querystring);
}