AJAX Background Send Without Caring About Response


function ajax_send_slider_value (slider_value_to_send)
{
	AjaxRequest1Parameters = "action=do_something";			//<<<<<SET PARAMETER TO POST (id1=val1&id2=val2 for multiple parameters)
	AjaxRequest1 = new ajaxRequest();
	AjaxRequest1.open("POST", "ajax.php", true);										//<<<<<SET THE FILE TO POST THE REQUEST TO
	AjaxRequest1.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
	AjaxRequest1.setRequestHeader("Content-length", AjaxRequest1Parameters.length);
	AjaxRequest1.setRequestHeader("Connection", "close");

	//SEND THE AJAX REQUEST
	AjaxRequest1.send(AjaxRequest1Parameters);			//Use (null) if there are no parameters to send
}




//************************************************
//************************************************
//********** CREATE AJAX REQUEST OBJECT **********
//************************************************
//************************************************
function ajaxRequest()
{
	//Cross browser - deal with IE varients
	try
	{
		//Non IE Browser
		var request = new XMLHttpRequest();
	}
	catch(e1)
	{
		try
		{
			//IE6?
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e2)
		{
			try
			{
				//IE5?
				request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e3)
			{
				//There is no Ajax support in this browser
				request = false;
			}
		}
	}
	return request;
}

 

 

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published.