Selecting an AJAX implementation

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Selecting an AJAX implementation

Post by Maugrim_The_Reaper »

First up, I have limited AJAX experience. I have used features from a few libraries (both the PHP libs and the DHTML toolkits) for small nuggets of functionality - but nothing overly complex.

As part of an open source project (try not to fall to pieces at it being one of those give-php-a-bad-name web games), my small 2-person development team has been discussing the project goals. What we are aiming for is a fully dynamic web application using AJAX. Think Yahoo's new mail server, for example. Of course we're all woefully underexperienced for a large-scale AJAX project but half the appeal of open source development is jumping in the deep end of something challenging and learning new skills in the process.

I'd prefer to leave this as an open topic - I'm not going to suggest a personal preference. What approach would readers suggest in terms of libraries (both DHTML Toolkits or PHP libs) considering performance must relate to a game which would see above average usage of the UI (lot's of fiendish teens frantically clicking buttons).

Bit of background. The application will use the Zend Framework to impose an MVC design. View and ORM abilities are supplied by non-ZF components. Game design is a non-issue - both of us have worked on game projects in the past in a few languages. It's the whole move from dynamic HTML pages to a unified web app under AJAX that has us wondering.
User avatar
DaveTheAve
Forum Contributor
Posts: 385
Joined: Tue Oct 03, 2006 2:25 pm
Location: 127.0.0.1
Contact:

Post by DaveTheAve »

Take a look at SAJAX the only thing i don't like about it is the fact it's <cough>Not OOP</cough>. Oh, and i'm not too fond of javascript's "security".

Edit: I take that back, I just tested SAJAX (code used proceding), and it wasn't really a security problem as long as you secure your PHP backend. There is really only URL hacking, the javascript is secure.

Code: Select all

<?php
	require("Sajax.php");

	/* Settings */
	$db_host = "[host]";
	$db_user = "[user]";
	$db_pass = "[pass]";
	$db_table = "[table]";

	require_once("mysql.class.php");
	$db = new sql($db_host, $db_user, $db_pass, $db_table);
	
	function search($name='') {
		global $db;
		$db->sql_query(__FILE__, __LINE__, "Select * from `contacts` where name Like '%".$name."%'");
		if($db->affected_rows() > 0) {
			while( $db_contacts = $db->fetch_array() ){
				$contacts[] = $db_contacts['name'] . " :-: " . $db_contacts['number'];
			}
		}
		
		return $contacts[0];
	}
	
	sajax_init();
	sajax_export("search");
	sajax_handle_client_request();
?>

<html>
<head>
	<title>Username Search</title>
	<script>
	<? sajax_show_javascript(); ?>
	
	function do_search_cb(z) {
		document.getElementById("results").value = z;
	}
	
	function do_search() {
		var username;
		
		name = document.getElementById("name").value;
		x_search(name, do_search_cb);
	}
	</script>
	
</head>
<body>
	<input type="text" id="name" value="" size="20"> <br />
	
	<input type="text" id="results" value="" size="100"> <br />
	<input type="button" name="search" value="Search"
		onclick="do_search(); return false;"> <br />
</body>
</html>
Thats all I used and I had a nice search engine for my custom phone directory on my computer. (Yeah, i got really PO'd one day when i needed a phone number which was at home when i was working at the court house. So i made a system to always have my numbers :) )
Post Reply