Jump to content

Two things in one ajax function


scuff

Recommended Posts

Is something like this possible?

 

//Browser Support Code
function ajaxFunction(){
var ajaxRequest;  // The variable that makes Ajax possible!
        

try{
	// Opera 8.0+, Firefox, Safari
	ajaxRequest = new XMLHttpRequest();
} catch (e){
	// Internet Explorer Browsers
	try{
		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try{
			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e){
			// Something went wrong
			alert("Your browser broke!");
			return false;
		}
	}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
        document.getElementById('test').innerHTML = ajaxRequest.responseText;
	}
}
   var file = 'site'; 
   ajaxRequest.open("GET", file, true);

  var params = "renewer=1";
  ajaxRequest2.open('POST', 'site.html', true);
  ajaxRequest2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  ajaxRequest2.setRequestHeader("Content-length", params.length);
  ajaxRequest2.setRequestHeader("Connection", "close");
  ajaxRequest2.send(params);
}

I'm trying to get it to post something to a page and read a page at the same time.

Link to comment
https://forums.phpfreaks.com/topic/130955-two-things-in-one-ajax-function/
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.