Jump to content

xmlhttp


napsternapster

Recommended Posts

Hi ppl,

 

Problem

The validateServer() function it calls executeAjax using false and works well with all other browsers but not firefox.On firefox submits without geting the response from the server and when I use true it does not work at. I need a way to make sure this function wirks well in all browsers the same way.

 

var server_error  //its a global variable 
function validateServer()
{
executeAjax(urlinfo_input,"GET","info_type_select","info_type_input","type_error");
executeAjax(urlinfo_input,"GET","group_type_select","group_type_input","group_error");
executeAjax(urlinfo_input,"GET","detailed_type_select","detailed_type_input","detailed_error");
executeAjax(urlinfo_input,"GET","detailed_identifiers_select","detailed_identifiers_input","identifier_error");	

    if(server_error == 0)
   {
f.submit();
//alert("counter = 0");
   }
}
[\code]

[code]

function executeAjax(url,method,select_id,input_id,error_id)
{
var xmlhttp = new GetXmlHttpObject();

if(method == 'GET')
{
	xmlhttp.open(method, url, false);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.onreadystatechange = function()
	{
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			if(xmlhttp.responseText != 0)
			{
				server_error = server_error + 1;
				document.getElementById(error_id).innerHTML = xmlhttp.responseText;
				document.getElementById(select_id).style.background = 'red';
				document.getElementById(input_id).style.background = 'red';
			}
		}
	}
	xmlhttp.send(null);
}
}

Link to comment
https://forums.phpfreaks.com/topic/170607-xmlhttp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.