JavaScript

OSCON 2007 Keynote from Steve Yegge

Steve Yegge of the Google presents his keynote: How to Ignore Marketing and Become Irrelevant in Two Easy Steps. From O'Reilly Media's Open Source Convention, July 26, 2007.

Cross Domain Ajax using Prototype and Ajax Extended

This is a quick guide to building cross domain Ajax applications using Prototype.js and Ajax Extended. First thing you will need to do is download the two needed libraries.
Prototype.js
http://prototype.conio.net/
Ajax Extended
http://ajaxextended.com/

First thing we need to do is modify prototype.js to use the Ajax Extended XMLHTTP object rather than Javascript’s native one.

Prototype.js

getTransport: function() {
return Try.these(
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
function() {return new XMLHttpRequest()}
) || false;
},

Needs to be changed to:

getTransport: function() {
return xmlhttp = new XMLHTTP();
},

You can now use cross domain Ajax using prototype.js while keeping all the functionality of prototype.js. Make sure you upload the Ajax Extended files and that you configue the Javascript file to point to your PHP file.

Syndicate content