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? -
<cfform action="" enablecab="Yes" onSubmit="formSubmission();">
-
<table align="center">
-
<tr><td>ICU Capacity:</td><td><cfoutput query="GetConstants"><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>
-
-
//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.XMLHTTP");
-
}
-
catch (e){
-
alert("Your browser does not support AJAX!");
-
//return false;
-
}
-
}
-
}
-
-
function formSubmission(){
-
xmlHttp.open('GET', 'ConstantsSubmit_v2.cfm', true);
-
xmlHttp.onreadystatechange = handleHttpResponse;
-
xmlHttp.send(null);
-
}
-
function handleHttpResponse() {
-
alert(xmlHttp.readyState);
-
if (xmlHttp.readyState == 4) {
-
var results = xmlHttp.responseText.split(',');
-
var testing = xmlHttp.responseText;
-
alert("Test " + results[1] + testing);
-
}
-
}
-
-
6 2676
what r you trying to send?(not everything can be display in alert() )
did you tried -
document.getElementById("myID").innerHTML=myData;
-
regards
jx2
I'm sorry, I didn't post enough of the code I think.
The problem I'm having is that I don't have access to the form fields on the page I'm calling with the ajax. -
<cfform action="javascript:formSubmission();" enablecab="Yes">
-
<table align="center">
-
<tr><td>ICU Capacity:</td><td><cfoutput query="GetConstants"><input type="Text" name="ICUCapSub" size="3" value="#ICUCap#" style="text-align: center;"> </td></tr>
-
<tr><td>Triaged And Waiting Capacity:</td><td><input type="Text" name="TAWCapSub" size="3" value="#TAWCap#" style="text-align: center;"></td></tr>
-
<tr><td>ED Side A Capacity:</td><td><input type="Text" name="EDASideCapSub" size="3" value="#EDASideCap#" style="text-align: center;"></td></tr>
-
</table>
-
</cfform>
-
-
/***** AJAX Functions *****/
-
function formSubmission(which,action,subPage,arg1,arg2){
-
//n = which.value;
-
//var q = 'query.cfm?accessID=';
-
//pageURL = subPage + arg1 + arg2 + n;
-
//alert(subPage);
-
//alert(action);
-
xmlHttp.open('POST', 'ConstantsSubmit_v2.cfm', true);
-
xmlHttp.onreadystatechange = handleHttpResponse;
-
xmlHttp.send(null);
-
}
-
function handleHttpResponse() {
-
alert(xmlHttp.readyState);
-
if (xmlHttp.readyState == 4) {
-
var results = xmlHttp.responseText.split(',');
-
var testing = xmlHttp.responseText;
-
alert("Test " + results[1] + results[2] + results[3] + testing);
-
var str = results[1];
-
updatepage('constants',str);
-
}
-
}
-
-
//This function will update an id on a page and insert the value into it.
-
function updatepage(pageID,str) {
-
document.getElementById(pageID).innerHTML = str;
-
}
-
Here I try to access the URL.ICUCapSub variable, but it's not there. -
<cfquery name="UpdateConstants" datasource="CodeGreyDW" dbtype="ODBC">
-
update tblConstants
-
set ICUCap = '#ICUCapSub#',
-
TAWCap = '#TAWCapSub#',
-
EDASideCap = '#EDASideCapSub#',
-
EDBSideCap = '#EDBSideCapSub#',
-
EDDefAdmitsCap = '#EDDefAdmitsCapSub#',
-
EDPotAdmitsCap = '#EDPotAdmitsCapSub#',
-
AmbHourCap = '#AmbHourCapSub#',
-
AMHealthCap = '#AMHealthCapSub#',
-
ACounselCap = '#ACounselCapSub#',
-
AcuityCap = '#AcuityCapSub#',
-
TransferCap = '#TransferCapSub#',
-
FWCap = '#FWCapSub#',
-
FWTeleCap = '#FWTeleCapSub#',
-
MSUCap = '#MSUCapSub#',
-
ThreeCCap = '#ThreeCCapSub#',
-
FourCap = '#FourCapSub#',
-
PediCap = '#PediCapSub#',
-
AdmAcuityDiv = '#AdmAcuityDiv#',
-
TotSumDiv = '#TotSumDiv#',
-
ResourceSumDiv = '#ResourceSumDiv#'
-
</cfquery>
-
-
<cfoutput>112,232,#ICUCapSub#,#URL.ICUCapSub#,
-
#Form.ICUCapSub#</cfoutput>
-
I've looked all around and have found a few tutorials on forms and ajax, but none that seem to be answering my question.
I have a form that has about 10 fields on it. I want to have the form submit without having to load a new page. That's where I want ajax to come in.
Here's my 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.XMLHTTP");
-
}
-
catch (e){
-
alert("Your browser does not support AJAX!");
-
//return false;
-
}
-
}
-
}
-
-
function formSubmission(){
-
xmlHttp.open('POST', 'ConstantsSubmit_v2.cfm', true);
-
xmlHttp.onreadystatechange = handleHttpResponse;
-
xmlHttp.send(null);
-
}
-
When the open function is called, shouldn't the page I'm calling (ConstantsSubmit_v2.cfm) have access to the form variables from the page?
Merged the threads because they are dealing with the same problem.
When the open function is called, shouldn't the page I'm calling (ConstantsSubmit_v2.cfm) have access to the form variables from the page?
When using POST, you have to send the form variables using the send() method.
When using POST, you have to send the form variables using the send() method.
Ok, so I need to loop through and retrieve all the input fields on the form before I send them. Thanks!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: robert.waters |
last post by:
Hi,
Why do firefox and IE6 render this differently?
http://mikewaters.net/div1.htm
The relevant divs are (in order that they appear in source):
1) float left; position relative; width 100px;...
|
by: Martin Chen |
last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main
frame. The contents frame has a menu bar written with with javascript (in
the context of a table). In IE6.1 everything...
|
by: Chris Sharman |
last post by:
See http://services.ccagroup.co.uk/testlink.html
It's valid html 4.01 transitional.
It contains 6 links: A1-A3, and B1-B3.
A is with no (default) style, B has "a img.nound { text-decoration:...
|
by: CColvin |
last post by:
I have an XSL file that I have created to format some XML files into a
viewable report for a browser. Viewing it locally I have no problems
in IE v6.0 or Firefox v1.5.0.1.
We plan on...
|
by: minnesotti |
last post by:
Hi there,
I subscribed to a photographic pictures-hosting website which is heavy
on JavaScript. My preferred latest browser Mozilla Firefox does not
work with it -- no pictures are displayed and...
|
by: AngryHank |
last post by:
I am sure I am not typing the correct question in Google or this group
to find the answer to my question. So, I have to ask.
I have a scrolling div that I am changing text color and background...
|
by: geetha v |
last post by:
Hi All,
I need a scrolling DIV is a to display my dynamic tree in left frame.
In my jsp , Div overflow is set to "auto"
<DIV id=divScroller style="overflow:auto;height:200px">
<!--...
|
by: ryanmhuc |
last post by:
Is there a way with javascript to force firefox on a page to display
the scrollbar even when the content does not extend outside the
viewable error?
Going from page to page where the scroll bar...
|
by: Chris |
last post by:
Ok, I am new to php and kinda self teaching myself but I haven't found
anyone with this problem. I am creating a site to manage my movies
basicly the site will add movies to a database and view, as...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| | |