hello people,
here is a piece of AJAX that i have used in my JS file. It's working fine with IE but somehow the page does not load in Firefox.

function secondRead(){	
	if(xmlHttp.readyState == 4){		
		if (xmlHttp.status == 200) {
			try{							        
        var status = xmlHttp.responseText;    
        alert(status);                   
        status = status.split(":")[0];
        status = status.split("ment ")[1];                      
        if(status == "Success"){
        	htmlResponse = "<div id=\"pixel\"><script src=\"https://ilogins.com/lead_third/5838/OPTIONAL_INFORMATION\"></script><noscript><img src=\"https://ilogins.com/track_lead/5838/OPTIONAL_INFORMATION\"></img></noscript><img src=\"https://www.lctrk.com/trkcpa.asp?ID=MTA2MDQ%3D\" width=\"1\" height=\"1\" ></img></div><table width=\"647\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">	<form name=\"survey\">  <tr>    <td height=\"979\" align=\"left\" valign=\"top\"><p><strong><font color=\"black\">Your transaction was successful.</font></strong>            </span></p>              <p class=\"Newfont1FAQ\">Congratulations,      </p>      <p class=\"Newfont1FAQ\">Your E-Commerce trainer will contact you within 1 business day. Please take a moment and fill out the survey below, so we may know how to serve you better.</p>              <table width=\"200\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#3b5bd7\">          <tr><td><table width=\"646\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bordercolor=\"#3b5bd7\" bgcolor=\"#e4eaff\">              <tr>                <td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">1. What do you currently do for a living?                  Which best describes your industry?</span></td>              </tr>              <tr>                <td width=\"75\" align=\"left\" valign=\"top\">&nbsp;</td>                <td width=\"555\" align=\"left\" valign=\"top\">  <span class=\"Newfont1FAQ\">                  <select name=\"a2\" id=\"profession\">                    <option value=\"NULL\"><strong>-----Business-----</strong></option>                    <option value=\"Agriculture, Fishing and Forestry\">Agriculture, Fishing and Forestry</option>                    <option value=\"Broadcast/Cable/Tv/Radio\">Broadcast/Cable/Tv/Radio</option>                    <option value=\"Construction\">Construction</option>                    <option value=\"Engineering and Management \">Engineering and Management </option>                    <option value=\"Graphic Design\">Graphic Design</option>                    <option value=\"Insurance\">Insurance</option>                    <option value=\"Legal\">Legal</option>                    <option value=\"Manufacturing\">Manufacturing</option>                    <option value=\"Media/Entertainment/Arts\">Media/Entertainment/Arts</option>                    <option value=\"Mining\">Mining</option>                    <option value=\"Non-Profit/Charity\">Non-Profit/Charity</option>                    <option value=\"Other Industry\">Other Industry</option>                    <option value=\"Printing and Publishing\">Printing and Publishing</option>                    <option value=\"Professional Services (Business)\">Professional Services (Business)</option>                    <option value=\"Professional Services (Technical, Web, IT)\">Professional Services (Technical, Web, IT)</option>                    <option value=\"Real Estate\">Real Estate</option>                    <option value=\"Retail/Wholesale/Trade\">Retail/Wholesale/Trade</option>                    <option value=\"Services\">Services</option>                    <option value=\"Technology/High Tech\">Technology/High Tech</option>                    <option value=\"Telecommunications\">Telecommunications</option>                    <option value=\"Transportation\">Transportation</option>                    <option value=\"Utilities\">Utilities</option>                    <option value=\"NULL\"><strong>-----Creative-----</strong></option>                    <option value=\"Advertising\">Advertising</option>                    <option value=\"Architecture\">Architecture</option>                    <option value=\"Film/Video/Animation Production\">Film/Video/Animation Production</option>                    <option value=\"Membership Organization\">Membership Organization</option><option value=\"Photography\">Photography</option><option value=\"Public Relations\">Public Relations</option><option value=\"Education\"><strong>-----Education-----</strong></option><option value=\"Education - Higher Ed\">Education - Higher Ed</option><option value=\"Education - K-12\">Education - K-12</option><option value=\"NULL\"><strong>-----Government-----</strong></option><option value=\"Government - Federal\">Government - Federal</option><option value=\"Government - Military/Aerospace &amp; Defense\">Government - Military/Aerospace &amp; Defense</option><option value=\"Government - State/Local\">Government - State/Local</option><option value=\"NULL\"><strong>-----Other-----</strong></option><option value=\"Other\">Other</option><option value=\"NULL\"><strong>-----Life Sciences-----<strong></option><option value=\"Health Care\">Health Care</option><option value=\"Hospitality and Food Services\">Hospitality and Food Services</option><option value=\"Pharmaceutical/Biotech\">Pharmaceutical/Biotech</option></select></span></td></tr><tr><td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">2. What is your age?</span></td>             </tr>              <tr>              	                <td align=\"left\" valign=\"top\">&nbsp;</td>                <td align=\"left\" valign=\"top\">                  <span class=\"Newfont1FAQ\">                 	                  	<input type=\"radio\" name=\"age\" value=\"Below 25\" checked=\"checked\"/>                  	Less Than 25 <br />                  	<input type=\"radio\" name=\"age\" value=\"Between 25-50\" />                  	25 - 50 <br />                  	<input type=\"radio\" name=\"age\" value=\"Above 50\" />                  	Above 50 </span>                                    </td>              </tr>              <tr>                <td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">3. What is a suitable time to contact you?</span></td>              </tr>              <tr>                <td align=\"left\" valign=\"top\">&nbsp;</td>                <td align=\"left\" valign=\"top\">                  <span class=\"Newfont1FAQ\">                                    	<input type=\"radio\" name=\"contactTime\" value=\"Before 12 noon\" checked=\"checked\"/>                  	Before 12 noon <br />                  	<input type=\"radio\" name=\"contactTime\" value=\"Between 12-5 pm\" />                  	Between 12 pm and 5 pm <br />                  	<input type=\"radio\" name=\"contactTime\" value=\"After 5 pm\" />                  	After 5 pm</span></td>              </tr>              <tr>                <td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">4. How Much Debt Are You In?</span></td>              </tr>              <tr>                <td align=\"left\" valign=\"top\">&nbsp;</td>                <td align=\"left\" valign=\"top\">                  <span class=\"Newfont1FAQ\">                     	                                 	<input type=\"radio\" name=\"debtAmount\" value=\"less than $10000\" checked=\"checked\" />                  	Less than $10,000  <br />                  	<input type=\"radio\" name=\"debtAmount\" value=\"between $10000-$50000\" />                  	Between $10,000 and $50,000 <br />                  	<input type=\"radio\" name=\"debtAmount\" value=\"between $50000-$100000\" />                  	Between $50,000 and $100,000 <br />                  	<input type=\"radio\" name=\"debtAmount\" value=\"more than $100000\" />                  	More than $100,000</span></td>              </tr>              <tr>                <td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">5. How Motivated Are You To Succeed?</span></td>              </tr>              <tr>                <td align=\"left\" valign=\"top\">&nbsp;</td>                <td align=\"left\" valign=\"top\">                  <span class=\"Newfont1FAQ\">                                    	<input type=\"radio\" name=\"motivatedStatus\" value=\"Not that motivated\" checked=\"checked\" />	                  Not that motivated <br />  	                <input type=\"radio\" name=\"motivatedStatus\" value=\"Slightly! Some extra cash would be nice\" />    	              Slightly! Some extra cash would be nice<br />      	            <input type=\"radio\" name=\"motivatedStatus\" value=\"Very Motivated! I need more money FAST\" />        	          Very Motivated! I need more money FAST <br />          	        <input type=\"radio\" name=\"motivatedStatus\" value=\"Extremely Motivated! I am in debt and at RISK\" />            	      Extremely Motivated! I am in debt and at RISK</span></td>              </tr>              <tr>                <td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">6. How Much Time Can You Dedicate To Making Money Online?</span></td>              </tr>              <tr>                <td align=\"left\" valign=\"top\">&nbsp;</td>                <td align=\"left\" valign=\"top\">                  <span class=\"Newfont1FAQ\">                                	    <input type=\"radio\" name=\"dedicatedTime\" value=\"Just 1-hour per week\" checked=\"checked\" />                	  Just 1-hour per week <br />		                <input type=\"radio\" name=\"dedicatedTime\" value=\"5-hours (1-hour per day)\" />    	              5-hours (1-hour per day)<br />      	            <input type=\"radio\" name=\"dedicatedTime\" value=\"10-hours (2-hours per day)\" />        	          10-hours (2-hours per day)<br />          	        <input type=\"radio\" name=\"dedicatedTime\" value=\"20-hours (4-hours per day)\" />            	      20-hours (4-hours per day)</span></td>              	</tr>              <tr>                <td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">7. If You Are Selected To Work With Our Team, How Committed Are  You to Using Our Training Program? Please Select One</span></td>              </tr>              <tr>                <td align=\"left\" valign=\"top\">&nbsp;</td>                <td align=\"left\" valign=\"top\">                  <span class=\"Newfont1FAQ\">                                  	  <input type=\"radio\" name=\"committedStatus\" value=\"I am not really that interested but I will at least see what all the fuss is about\" checked=\"checked\" />                  	I am not really that interested but  I will at least see what all the fuss is about <br />	                  <input type=\"radio\" name=\"committedStatus\" value=\"I think this might work for me. I am willing to try anything once\" />                  I think this might work for me. I am willing to  try anything once<br />  	                <input type=\"radio\" name=\"committedStatus\" value=\"I am 100% committed\" />    	              I am 100% committed</span></td>      	        </tr>              <tr>                <td colspan=\"2\" align=\"left\" valign=\"top\"><span class=\"Newfont1FAQ\">8. If you are selected, what would your goals be?</span></td>              </tr>              <tr>                <td align=\"left\" valign=\"top\">&nbsp;</td>                <td align=\"left\" valign=\"top\">                  <span class=\"Newfont1FAQ\">                          	          <input type=\"radio\" name=\"goals\" value=\"I would like to quit my job and work from home\" checked=\"checked\" />          	        I would like to quit my job and work from home<br />            	      <input type=\"radio\" name=\"goals\" value=\"I would like to get out of debt\" />              	    I would like to get out of debt <br />                	  <input type=\"radio\" name=\"goals\" value=\"I want to secure my financial future\" />                  	I want to secure my financial future</span></td>	              </tr>              <tr>                <td colspan=\"2\" align=\"center\" valign=\"top\"><span class=\"Newfont1FAQ\">                  <a href=\"javascript: void(0)\" onclick=\"surveyVerify()\"><img src=\"Images/SubmitButton.jpg\" id=\"submitSurvey\" style=\"border-style: none\"/></a>                </span></td>              </tr>            </table></td>          </tr>        </table>        <span class=\"Tahoma1\"><br />        </span>      </td>  </tr>  </form></table><div id=\"pixel2\"><img src=\"http://www.lctrk.com/trkcpa.asp?ID=MTA2MDQ%3D\" width=\"1\" height=\"1\" ></img></div>";              
        }
        else if(status == "Failed"){
        	htmlResponse = "<table width=\"647\" height=\"232\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">  <tr>    <td height=\"226\" align=\"left\" valign=\"top\"><br />      <span class=\"Tahoma\"><strong><font color=\"black\">There was a processing  error, please click the home button and try again.</font></strong><br />      </span><span class=\"Tahoma1\"><br />      <a href=\"javascript: void(0)\" onmouseover=\"mouseOverImage('home', 'Images/HomePressed.jpg')\" onmouseout=\"mouseOutImage('home', 'Images/Home.jpg')\" onclick=\"load()\"><img src=\"Images/Home.jpg\" id=\"home\" style=\"border-style: none\"/></a><br />      </span></td>  </tr></table>";
        }        
        document.getElementById("main").innerHTML = htmlResponse;	
               
      }
      catch(err){
      	alert("!!!");
      }
  	}
  }
}//end of secondRead()

it could be something about the split() used here.
please have a look and let me know ASAP.

thank you.

I'd be willing to bet the error isn't in that function. And what the heck is the point of using AJAX if you're just going to rewrite the response to your own static HTML anyway? You're completely defeating the purpose of AJAX.

I though the problem was in those unfathomable strings of HTML in your code. But I checked your HTML strings for orphan or not slashed double quotes, and found no typos (php: echo preg_replace('/((?<!\\\\)")/', '********', $TXT); ).
I think the bug is in the logic of your code. Look at these lines:

var status = xmlHttp.responseText;
status = status.split(":")[0];
status = status.split("ment ")[1];

if(status == "Success"){ 
  htmlResponse = $$$$1;
}else if(status == "Failed"){
  htmlResponse = $$$$2;
}

what if the xmlHttp.responseText is this
"$data_that_has_no_"MENT[SPACE]"_in_it and that is discardedMENT[SPACE] <WHAT_YOUR_CODE_GETS_WITH_FIRST_LINES>:some $#@! unused response text";

After you extract the <WHAT_YOUR_CODE_GETS_WITH_FIRST_LINES> substring from the response, you do a very strict comparison of it to "Success" of "Falied" (first letter capitalized). I think finally your htmlResponse variable is empty.

What I recommend you to try is:

var status = xmlHttp.responseText;
status = status.split(":")[0];
status = status.split("ment ")[1];
/*added these lines */
status = status.replace(/^\s+/,''); //remove leading spaces
status = status.replace(/\s+$/,''); //remove trailing spaces
status = status.toUpperCase(); //make reply all uppercase

 /* removed this statement   if(status == "Failed")   */ 
if(status == "SUCCESS"){ 
  htmlResponse = $$$$1;
}else{
  htmlResponse = $$$$2;
}

this way you'll get more stable reply from the server and your htmlResponse will surely be non empty.

I hope this helps solve your problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.