Thursday, September 8th, 2005

Simple Ajax with MochiKit and JSON

Category: Articles, JavaScript, Library

Andrew Gross has written part one of a series of tutorials on using the MochiKit JavaScript framework to write Ajax web applications.

The article goes into creating the beginnings of a Blog system:

function BlogPost(info) { 
  bindMethods(this);
  this.info = info;
}

BlogPost.prototype.makeDiv = function() { 
  return DIV({'class' : 'blogpost'},
	     H2(null, this.info.title),
	     HR(),
	     SPAN(null, this.info.content), 
	     BR(), BR(),
	     SPAN(null, 
		  "Posted by " + this.info.author + " at " + this.info.date));
}

BlogPost.prototype.render = function(targetDiv) {
  targetDiv.appendChild(this.makeDiv());
}

Posted by Dion Almaer at 12:00 am
Comment here

+++--
3.2 rating from 6 votes

Comments Here »

Comments feed

Leave a comment

You must be logged in to post a comment.