Hello,

I am having problems retrieving correct values from two radio buttons in my AJAX script below.

The radio button values are either a 1 or 0 and always produces 0 regardless of which button is selected.

Once in AJAX, I can not have the script retreive a 1 or 0. AJAX script produces "[object HTMLInputElement]" as the response. Not sure what is going wrong.

Thanks in Advance.
Diego

<?php
var settings = getXmlHttpRequestObject(); function saveCar() { 
if (settings.readyState == 4 || settings.readyState == 0) { 

var car = escape(document.getElementById('car').value);

/* PROBLEM - Radio Button Processor */
var proc17 = document.getElementById("search17");
for (var i = 0; i < proc17.length; i++)
{
    if (proc17[i].checked){
       search17 = proc17[i].value;
       break;
    }
}


settings.open("GET", 'abc.php?proc17=' + proc17 + '&car=' +car, true); 
settings.onreadystatechange = handleSettings; settings.send(null);}}
function handleSettings() { if (settings.readyState == 4) { 

		}
	}
?>

The actual code is running in proper javascript format. when i posted the question I had not slept. The correct format is the following:

<script type="text/javascript">
var settings = getXmlHttpRequestObject(); function saveCar() { 
if (settings.readyState == 4 || settings.readyState == 0) { 

var car = escape(document.getElementById('car').value);

/* PROBLEM - Radio Button Processor */
var proc17 = document.getElementById("search17");
for (var i = 0; i < proc17.length; i++)
{
    if (proc17[i].checked){
       search17 = proc17[i].value;
       break;
    }
}


settings.open("GET", 'abc.php?proc17=' + proc17 + '&car=' +car, true); 
settings.onreadystatechange = handleSettings; settings.send(null);}}
function handleSettings() { if (settings.readyState == 4) { 

		}
	}
</script>
This article has been dead for over six months. Start a new discussion instead.