[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 03-25-2006, 08:22 PM   #1 (permalink)
NamePros Regular
 
cvxdes's Avatar
 
Join Date: Oct 2005
Location: Milford MA
Posts: 692
96.45 NP$ (Donate)

cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of


Awful 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 admin@cvxdes.com, i'll pay.

Last edited by cvxes; 03-25-2006 at 08:31 PM.
cvxdes is offline  
Old 04-02-2006, 06:21 AM   #2 (permalink)
First Time Poster!
 
Join Date: Apr 2006
Posts: 1
0.00 NP$ (Donate)

green_ryu is an unknown quantity at this point


Talking have been resolved?

cvxes, I'd have same problem.. have u figure yet the trick to resolve thats?
green_ryu is offline  
Old 04-02-2006, 11:14 AM   #3 (permalink)
NamePros Member
 
Join Date: Mar 2006
Posts: 62
47.05 NP$ (Donate)

123finder.com is an unknown quantity at this point


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
}
__________________
123finder.com - Browse dictionary domains & 4-9 letter domains
123finder.com is offline  
Old 04-04-2006, 03:46 PM   #4 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Location: Connecticut, USA
Posts: 286
71.76 NP$ (Donate)

Darkneoboi is an unknown quantity at this point


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?
__________________
DarkNeoNetwork
Darkneoboi is offline  
Old 04-17-2006, 12:11 AM   #5 (permalink)
Professional Monkey
 
Amnezia's Avatar
 
Join Date: Jul 2005
Location: Escaped from the zoo
Posts: 908
13.25 NP$ (Donate)

Amnezia has a spectacular aura aboutAmnezia has a spectacular aura about

Cancer Survivorship Save a Life
have you tried the xajax framework? it makes it 10 times easier to creat calls and returns between php and the client side javascript.
__________________
[http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url]
Amnezia is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:09 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85