Hi i had php form in a page and I make the submit function using a javascript function ( some thing like protypes.js ). It is working fine in IE , Opera ... Nut doesn't in Firefox. Here is the code. Please any one help me to work in Firefox ..

function sendRequest() {
			document.getElementById('mn').style.display='none';
			document.getElementById('result_succ').style.display='block';
			$('print').innerHTML= "Processing Please wait";
			
			
				new Ajax.Request("comment.php", 
					{ 
					method: 'post', 
					postBody: 'name='+ $F('name')+'&email='+ $F('email')+'&comments='+ $F('comments')+'&id='+ $F('id'),
					onComplete: showResponse 
					});
				}

			function showResponse(req){
			///alert("_"+req.responseText+"_");
			var b=req.responseText;
			var a= b.substring(0,2);
if(a=="ok"){
				
			document.getElementById('mn').style.display='none';
			document.getElementById('result_succ').style.display='block';
			$('print').innerHTML= "Thank you for your comment";

				}
				else {
				document.getElementById('mn').style.display='none';
			document.getElementById('result_succ').style.display='block';
			$('print').innerHTML= "Error !! Please Try again";
				}
				
			}

Thanks
Rajeesh

To ensure the flexibility of your request in Gecko (Firefox) based browser's, you can simply add an extra method of:

// Assuming that everything is declared

var requestObject = new XMLHttpRequest();
requestObject.overrideMimeType("text/xml"); // A method that overrides, header sent by the server, just incase it's not text/xml.

// The rest of the lines goes on...

And if you are POST-ing any data to the server, then you'll have to change the MIME type of the request, like this:

requestObject.setRequestHeader("Content-Type", "x-www-form-urlencoded");
requestObject.onreadystatechange = functionRef; // and so...on...

Hope it helps you, in what you need...

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.