The Jquery Divide
The Jquery Divide
http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-2
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","ajax_test.asp",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-
form-urlencoded");
xmlhttp.send("fname=Henry&lname=Ford");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("myDiv").innerHTML =
xmlhttp.responseText;
}
};
init : function(el) {
this.el = el;
$.subscribe('/search/results', $.proxy(this, '_showResults'));
},
_showResults : function(results) {
var tpl = this.itemTemplate,
html = $.map(results, function(r) {
return tpl
.replace('%title', r.title)
.replace('%desc', r.desc);
}).join('');
this.el.append(html);
}
});
});
init : function(el) {
this.el = el;
$.subscribe('/search/results', $.proxy(this, '_showResults'));
},
_showResults : function(results) {
var tpl = this.itemTemplate,
html = $.map(results, function(r) {
return tpl
.replace('%title', r.title)
.replace('%desc', r.desc);
omg wtf is this???
}).join('');
this.el.append(html);
}
});
});
jQuery
http://xpandapopx.deviantart.com/art/The-Prideful-Hypocrite-68848153
child.on('click', fn);
parent.appendChild(child);
// Dojo
var parent = dojo.create('div'),
child = dojo.create('p', { innerHTML : 'foo' });
// jQuery
var parent = $('<div/>');
$('<p>foo</p>')
.click(fn)
.appendTo(parent);
http://www.clientcide.com/deep-thoughts/why-its-a-good-idea-to-be-a-javascript-developer-and-what-it-takes-to-be-one/#comment-32703
anks, in guilt-free alphabetical order, to: Tim Caswell, John Hann, Peter Higgins, Tom Hughes-
Croucher, Paul Irish, Brian LeRoux, Roger Raymond, Alex Sexton, Colin Snover, Adam Sontag, Chris
Williams, and to everyone who listened to me formulate my thoughts.