1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
var URL = 'http://***' ;
var LOADER = '<img src="'+URL+'/_IMG/loading.gif" width="16" height="16" alt="Loading..." />' ;
var VERIF = 'V\351rifications en cours...' ;
function popup(message)
{
document.getElementById('message').innerHTML=message ;
document.getElementById('popup').style.display='block' ;
document.getElementById('inpopup').style.display='block' ;
}
function closepopup()
{
document.getElementById('popup').style.display='none' ;
document.getElementById('inpopup').style.display='none' ;
}
function contact(page)
{
document.getElementById('submit').value=VERIF ;
document.getElementById('submit').disabled=true ;
document.getElementById('formloading').innerHTML=LOADER ;
var xhr = ajax() ;
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4 && xhr.status == 200)
{
result = xhr.responseText.split('|') ;
if (result[0] == '1')
{
document.getElementById('formpage').style.display='none' ;
popup(''+result[1]+'') ;
}
else
{
msgerror = '' ;
nberrors = result.length ;
for (xi=1; xi<nberrors; xi++)
{
xerror = result[xi].split('#') ;
msgerror = msgerror+'<p>'+xerror[1]+'</p>' ;
$('#'+xerror[0]).effect("highlight", { color: '#e3b5c5'}, 5000) ;
}
popup(''+msgerror+'') ;
document.getElementById('submit').value="Envoyer" ;
document.getElementById('submit').disabled=false ;
document.getElementById('formloading').innerHTML='' ;
}
}
}
mypost = function()
{
xhr.open('POST', URL+'/_PHP/post-contact.php', true) ;
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded') ;
xhr.send(getFields('formpage')) ;
}
setTimeout('mypost()', 1000) ;
} |