Category Archives: Ajax

Almost Web2.0

I thought i’d check if VideoTag was web2.0 or not http://web2.0validator.com

It checks your site against a list of rules that are created through people bookmarking the site in del.icio.us. VideoTag scored 8 out of 66, so i guess i’m not web2.0, however according to the results, i don’t use tags, mention a long tail or use Ajax, which i do, so i guess that makes me 11 out of 66 which is still pretty rubbish.

It did say i was web3.0 though, maybe VideoTag’s too ahead of the game to be web2.0!!

Maybe i’ll set up a rule – “Mentions VideoTag” score an extra point!

The results:

  • Uses python? No
  • Denies the existance of Rocky V ? No
  • Is in public beta? No
  • Rocks out to the dance noise sound of Chinese Forehead ? No
  • Uses inline AJAX ? No
  • Uses the prefix “meta” or “micro”? No
  • Mentions Tag Clouds? No
  • Is Shadows-aware ? No
  • Mentions Neowin.net ? No
  • Apperars to use moo.fx ? No
  • Appears to be non-empty ? No
  • Has a Blogline blogroll ? No
  • Uses tags ? No
  • Appears to be web 3.0 ? Yes!
  • Attempts to be XHTML Strict ? No
  • Uses Google Maps API? No
  • Has favicon ? Yes!
  • Refers to mash-ups ? No
  • Uses Cascading Style Sheets? Yes!
  • Mentions startup ? No
  • Mentions Less is More ? No
  • Received a cease-and-desist from CMP Media or Tim O’Reilly ? No
  • Uses the word meme? No
  • Appears to use AJAX ? No
  • Refers to the Web 2.0 Validator’s ruleset ? No
  • Mentions an “architecture of participation”? No
  • Appears to have a Google Sitemap ? No
  • Appears to use RSS ? No
  • Makes reference to Technorati ? No
  • Refers to Flickr ? No
  • JavaScript by Dreamweaver ? No
  • Faviconized ? Yes!
  • Refers to VCs ? No
  • Mentions The Long Tail ? No
  • Appears to be built using Django ? No
  • Links Slashdot and Digg ? No
  • Mentions Ruby? No
  • Appears to use moo.fx ? No
  • Mentions Cool Words ? No
  • Mentions Nitro ? No
  • Mentions Ruby ? No
  • Has prototype.js ? No
  • Refers to podcasting ? No
  • Mentions Wisdom Of Crowds ? No
  • Creative Commons license ? No
  • Appears to use visual effects? No
  • Appears to use MonoRail ? No
  • Refers to Rocketboom ? No
  • Uses Semantic Markup? Yes!
  • Links to validator? No
  • Refers to del.icio.us ? No
  • Mentions RDF and the Semantic Web? No
  • Actually mentions Web 2.0 ? Yes!
  • Use Catalyst ? No
  • Mentions Neurogami and Web 2.0 ? No
  • Refers to web2.0validator ? No
  • Uses microformats ? No
  • Mentions a blog ? Yes!
  • Does it use DWR Ajax Library? No
  • References Firefox? No
  • Appears to over-punctuate ? No
  • Validates as XHTML 1.1 ? No
  • References isometric.sixsided.org? No
  • Appears to have Adsense ? No
  • Uses the “blink” tag? Yes!
  • Mentions Stickbob? No

Ajax GET and POST

I’m posting my GET and POST ajax code it will hopefully be useful to some people.

I searched a lot to find some simple code as i didn’t need to validate the forms. So many scripts didn’t work properly or seemed unnecesserily complicated for my requirements.

The code has been adapted from
http://www.w3schools.com/ajax/def

the GET from:
http://www.openjs.com/articles/ajax_xmlhttp_using_post.php

Hope you find this helpful!

//Set up the XMLHttpRequest

var http = createRequestObject();
function createRequestObject() {
var objAjax;
var browser = navigator.appName;
if(browser == “Microsoft Internet Explorer”){
objAjax = new ActiveXObject(“Microsoft.XMLHTTP”);
}else{
objAjax = new XMLHttpRequest();
}
return objAjax;
}

//THE GET

function getNewContent(){
http.open(‘get’,’newcontent.php’);
http.onreadystatechange = updateNewContent;
http.send(null);
return false;
}

function updateNewContent(){
if(http.readyState == 4){
document.getElementById(‘Content’).innerHTML = http.responseText;
}
}

//THE POST

function postForm() {
var url = “formentry.php”;
var formtag = document.getElementById(‘fmfield’).value;
var params = “newfield=” + formfield;
http.open(“POST”, url, true);

//Send the proper header information along with the request
http.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”);
http.setRequestHeader(“Content-length”, params.length);
http.setRequestHeader(“Connection”, “close”);

http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
document.getElementById(‘fomentered’).innerHTML = http.responseText;
document.getElementById(‘fmfield’).value = “”;
}
}
http.send(params);
}

the functions are called through an onclick event
e.g.
GET <a href=”#” onclick=”getNewContent()”>New Content</a>
POST <a href=”#” onclick=”postForm()”><img src=”Submit.gif”></a>

I couldn’t get it to work properly with a button with type image and i wanted an image so i did it with an <a> tag – i think it works with a normal <input type=”button” onclick=”postForm()”> But it won’t work if you have an <input type=”submit”> button.

I am still trying to figure out how to get it to work when the user presses return or enter – it calls the postForm() but refreshes the page.

If any one can help me on this please comment!!