473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Results missing in Firefox, viewable in IE

219 100+
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?

Expand|Select|Wrap|Line Numbers
  1.     <cfform action="" enablecab="Yes" onSubmit="formSubmission();">
  2.     <table align="center">
  3.         <tr><td>ICU Capacity:</td><td><cfoutput query="GetConstants"><input type="Text" name="ICUCapSub" size="3" value="#ICUCap#" style="text-align: center;"> </td></tr>
  4.     <tr><td colspan="2" align="center"><input type="Submit" value="Submit">  </td></tr>
  5.     </table>
  6.     </cfform>
  7.  
Expand|Select|Wrap|Line Numbers
  1. //Retrieve XMLHttpRequest object to use for AJAX Development
  2. var xmlHttp;
  3. try{
  4. // Firefox, Opera 8.0+, Safari
  5.     xmlHttp=new XMLHttpRequest();
  6. }
  7. catch (e){
  8. // Internet Explorer
  9.   try
  10.   {
  11.   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  12.   }
  13. catch (e){
  14.   try{
  15.     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  16.     }
  17.   catch (e){
  18.     alert("Your browser does not support AJAX!");
  19.     //return false;
  20.     }
  21.   }
  22. }
  23.  
  24. function formSubmission(){
  25.     xmlHttp.open('GET', 'ConstantsSubmit_v2.cfm', true);
  26.     xmlHttp.onreadystatechange = handleHttpResponse;
  27.     xmlHttp.send(null);
  28. }
  29. function handleHttpResponse() {
  30.     alert(xmlHttp.readyState);
  31.     if (xmlHttp.readyState == 4) {
  32.         var results = xmlHttp.responseText.split(',');
  33.         var testing = xmlHttp.responseText;
  34.         alert("Test " + results[1] + testing);
  35.     }
  36. }
  37.  
  38.  
Oct 29 '07 #1
6 2676
jx2
228 100+
what r you trying to send?(not everything can be display in alert() )
did you tried
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("myID").innerHTML=myData;
  2.  
regards
jx2
Oct 29 '07 #2
dmorand
219 100+
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.

Expand|Select|Wrap|Line Numbers
  1. <cfform action="javascript:formSubmission();" enablecab="Yes">
  2.     <table align="center">
  3.         <tr><td>ICU Capacity:</td><td><cfoutput query="GetConstants"><input type="Text" name="ICUCapSub" size="3" value="#ICUCap#" style="text-align: center;"> </td></tr>
  4.     <tr><td>Triaged And Waiting Capacity:</td><td><input type="Text" name="TAWCapSub" size="3" value="#TAWCap#" style="text-align: center;"></td></tr>
  5.     <tr><td>ED Side A Capacity:</td><td><input type="Text" name="EDASideCapSub" size="3" value="#EDASideCap#" style="text-align: center;"></td></tr>
  6. </table>
  7. </cfform>
  8.  
Expand|Select|Wrap|Line Numbers
  1. /***** AJAX Functions *****/
  2. function formSubmission(which,action,subPage,arg1,arg2){
  3.     //n = which.value;
  4.     //var q = 'query.cfm?accessID=';
  5.     //pageURL = subPage + arg1 + arg2 + n;
  6.     //alert(subPage);
  7.     //alert(action);
  8.     xmlHttp.open('POST', 'ConstantsSubmit_v2.cfm', true);
  9.     xmlHttp.onreadystatechange = handleHttpResponse;
  10.     xmlHttp.send(null);
  11. }
  12. function handleHttpResponse() {
  13.     alert(xmlHttp.readyState);
  14.     if (xmlHttp.readyState == 4) {
  15.         var results = xmlHttp.responseText.split(',');
  16.         var testing = xmlHttp.responseText;
  17.         alert("Test " + results[1] + results[2] + results[3] + testing);
  18.         var str = results[1];
  19.         updatepage('constants',str);
  20.     }
  21. }
  22.  
  23. //This function will update an id on a page and insert the value into it.
  24. function updatepage(pageID,str) {
  25.     document.getElementById(pageID).innerHTML = str;
  26. }
  27.  
Here I try to access the URL.ICUCapSub variable, but it's not there.

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="UpdateConstants" datasource="CodeGreyDW" dbtype="ODBC">
  2. update tblConstants 
  3. set ICUCap = '#ICUCapSub#',
  4. TAWCap = '#TAWCapSub#',
  5. EDASideCap = '#EDASideCapSub#',
  6. EDBSideCap = '#EDBSideCapSub#',
  7. EDDefAdmitsCap = '#EDDefAdmitsCapSub#',
  8. EDPotAdmitsCap = '#EDPotAdmitsCapSub#',
  9. AmbHourCap = '#AmbHourCapSub#',
  10. AMHealthCap = '#AMHealthCapSub#',
  11. ACounselCap = '#ACounselCapSub#',
  12. AcuityCap = '#AcuityCapSub#',
  13. TransferCap = '#TransferCapSub#',
  14. FWCap = '#FWCapSub#',
  15. FWTeleCap = '#FWTeleCapSub#',
  16. MSUCap = '#MSUCapSub#',
  17. ThreeCCap = '#ThreeCCapSub#',
  18. FourCap = '#FourCapSub#',
  19. PediCap = '#PediCapSub#',
  20. AdmAcuityDiv = '#AdmAcuityDiv#',
  21. TotSumDiv = '#TotSumDiv#',
  22. ResourceSumDiv = '#ResourceSumDiv#'
  23. </cfquery>
  24.  
  25. <cfoutput>112,232,#ICUCapSub#,#URL.ICUCapSub#,
  26. #Form.ICUCapSub#</cfoutput>
  27.  
Oct 30 '07 #3
dmorand
219 100+
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:

Expand|Select|Wrap|Line Numbers
  1. //Retrieve XMLHttpRequest object to use for AJAX Development
  2. var xmlHttp;
  3. try{
  4. // Firefox, Opera 8.0+, Safari
  5.     xmlHttp=new XMLHttpRequest();
  6. }
  7. catch (e){
  8. // Internet Explorer
  9.   try
  10.   {
  11.   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  12.   }
  13. catch (e){
  14.   try{
  15.     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  16.     }
  17.   catch (e){
  18.     alert("Your browser does not support AJAX!");
  19.     //return false;
  20.     }
  21.   }
  22. }
  23.  
  24. function formSubmission(){
  25.     xmlHttp.open('POST', 'ConstantsSubmit_v2.cfm', true);
  26.     xmlHttp.onreadystatechange = handleHttpResponse;
  27.     xmlHttp.send(null);
  28. }
  29.  
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?
Oct 30 '07 #4
acoder
16,027 Expert Mod 8TB
Merged the threads because they are dealing with the same problem.
Oct 30 '07 #5
acoder
16,027 Expert Mod 8TB
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.
Oct 30 '07 #6
dmorand
219 100+
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!!
Oct 30 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
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;...
5
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...
10
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:...
2
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...
11
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...
3
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...
3
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"> <!--...
6
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...
1
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.