function change( el)
{
if ( el.value == "ON" )
{
el.value = "OFF";
el.style.backgroundColor = "#ff3333"; /* Red */
}
else
{
el.value = "ON";
el.style.backgroundColor = "#4CAF50"; /* Green*/
} // works till here like expected.
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
}
}
xmlhttp.open("GET", "postform.php?switch=" + el.value, true)
xmlhttp.send();
}
samedi 28 mai 2016
how to pass a variable from javascript function to php file without reloading the current html page in which javascript function is written?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire