I'm having a little trouble with my ajax. I can see my results in IE, but not firefox. I'm assuming I'm missing some syntax somewhere.
alert("Test " + results[1] + testing); returns the values in IE, but in Firefox it says undefined
Any ideas why this can happen?
[code=html]
<cfform action="" enablecab="Yes" onSubmit="formS ubmission();">
<table align="center">
<tr><td>ICU Capacity:</td><td><cfoutpu t query="GetConst ants"><input type="Text" name="ICUCapSub " size="3" value="#ICUCap# " style="text-align: center;"> </td></tr>
<tr><td colspan="2" align="center"> <input type="Submit" value="Submit"> </td></tr>
</table>
</cfform>
[/code]
[code=javascript]
//Retrieve XMLHttpRequest object to use for AJAX Development
var xmlHttp;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest( );
}
catch (e){
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(" Msxml2.XMLHTTP" );
}
catch (e){
try{
xmlHttp=new ActiveXObject(" Microsoft.XMLHT TP");
}
catch (e){
alert("Your browser does not support AJAX!");
//return false;
}
}
}
function formSubmission( ){
xmlHttp.open('G ET', 'ConstantsSubmi t_v2.cfm', true);
xmlHttp.onready statechange = handleHttpRespo nse;
xmlHttp.send(nu ll);
}
function handleHttpRespo nse() {
alert(xmlHttp.r eadyState);
if (xmlHttp.readyS tate == 4) {
var results = xmlHttp.respons eText.split(',' );
var testing = xmlHttp.respons eText;
alert("Test " + results[1] + testing);
}
}
[/code]
alert("Test " + results[1] + testing); returns the values in IE, but in Firefox it says undefined
Any ideas why this can happen?
[code=html]
<cfform action="" enablecab="Yes" onSubmit="formS ubmission();">
<table align="center">
<tr><td>ICU Capacity:</td><td><cfoutpu t query="GetConst ants"><input type="Text" name="ICUCapSub " size="3" value="#ICUCap# " style="text-align: center;"> </td></tr>
<tr><td colspan="2" align="center"> <input type="Submit" value="Submit"> </td></tr>
</table>
</cfform>
[/code]
[code=javascript]
//Retrieve XMLHttpRequest object to use for AJAX Development
var xmlHttp;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest( );
}
catch (e){
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(" Msxml2.XMLHTTP" );
}
catch (e){
try{
xmlHttp=new ActiveXObject(" Microsoft.XMLHT TP");
}
catch (e){
alert("Your browser does not support AJAX!");
//return false;
}
}
}
function formSubmission( ){
xmlHttp.open('G ET', 'ConstantsSubmi t_v2.cfm', true);
xmlHttp.onready statechange = handleHttpRespo nse;
xmlHttp.send(nu ll);
}
function handleHttpRespo nse() {
alert(xmlHttp.r eadyState);
if (xmlHttp.readyS tate == 4) {
var results = xmlHttp.respons eText.split(',' );
var testing = xmlHttp.respons eText;
alert("Test " + results[1] + testing);
}
}
[/code]
Comment