Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Ajax

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
have been resolved?

cvxes, I'd have same problem.. have u figure yet the trick to resolve thats? :alien:
 
0
Close
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
Close
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
Close
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
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back