Unstoppable Domains

Ajax

Spaceship Spaceship
Watch

cvxdes

Established Member
Impact
14
Ajax - Will pay

This ajax is giving me hell. It's suposed to use posting of data and XML Trees.
Im working on my site, Not like i can get it to post anyways, but the php backend already works. Depending on the $_POST['id'], it'll return a tree like this:
<id>1</id>
<title>Title</title>
<links>Links</links>
<cont>Cont</cont>
<banner>0</banner>

Alright, so how to i get all these values into strings, so i can use the functions that i already wrote for them.

So, in short...

How to get ajax to post, and how do i get it to get the reply from the file that it posted to?

If you think you might be able to do this, MSN me at [email protected], i'll pay.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
have been resolved?

cvxes, I'd have same problem.. have u figure yet the trick to resolve thats? :alien:
 
0
•••
This AJAX code we use can do both POST/GET. Also, there are available AJAX libraries you can use to simplify the job.
Code:
function createRequestObject() {
    var $vObj;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		$vObj = new XMLHttpRequest();
		if ($vObj.overrideMimeType) {
			$vObj.overrideMimeType('text/xml');
		} // fi
	} else if (window.ActiveXObject) { // IE
		try {
			$vObj = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				$vObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		} // fi

		if (!$vObj) { // failed, cannot create
            return false;
        } // fi
	} // fi
    return $vObj;
}

var $vAJAX = createRequestObject();
var $globAJAXBusy = false;

function checkAJAX() {
	if ($globAJAXBusy) {
		$vAJAX.onreadystatechange = function () {}
		$vAJAX.abort();
	} // fi
}

function requestPage($pURL) {
	checkAJAX();
    $vAJAX.open('GET',$pURL,true);
	$globAJAXBusy = true;
    $vAJAX.onreadystatechange = handleResponse;
    $vAJAX.send(null);
}

function postPage($pURL,$pParams) {
	checkAJAX();
	$vAJAX.open('POST',$pURL,true);
	$globAJAXBusy = true;
	$vAJAX.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	$vAJAX.setRequestHeader("Content-length",$pParams.length);
	$vAJAX.setRequestHeader("Connection","close");
	$vAJAX.send($pParams);
	$vAJAX.onreadystatechange = handleResponse;
}

function handleResponse() {
    if(typeof($vAJAX)=='undefined' || $vAJAX.readyState!=4){
		return false;
	} // fi
	
	try {
		if ($vAJAX.status!=200) { // error page
			return false;
		} // fi
	} catch(e) {
		return false;
	} 

	$globAJAXBusy = false;
	var $vResult = $vAJAX.responseXML;
        ..... // do something
}
 
0
•••
If you have AJAX code and you don't want people to use the back button, is there a way to disable the backbutton the the Browser or the Mouse if they have one there?
 
0
•••
have you tried the xajax framework? it makes it 10 times easier to creat calls and returns between php and the client side javascript.
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back