version 1.2, 2010/01/18 04:51:15 |
version 1.4, 2010/01/31 02:31:47 |
|
|
<html><head> |
<html><head> |
<title>todo.txt - javascript client</title> |
<title>todo.txt - ajax client</title> |
<script src="prototype.js" type="text/javascript"></script> |
<link rel="stylesheet" href="todo.css"> |
|
<script src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js"></script> |
<script type='text/javascript'> |
<script type='text/javascript'> |
|
var base_url = '/~andrew/user-bin/todo.cgi'; |
|
|
|
function loadIntoNode(data, xhr){ |
|
if(xhr.args.node){ |
|
xhr.args.node.innerHTML = data; |
|
} |
|
} |
function getFiles() { |
function getFiles() { |
document.getElementById('files').innerHTML = "Getting Files . . ."; |
dojo.byId('files').innerHTML = "Getting Files . . ."; |
new Ajax.Request('/~andrew/user-bin/todo.cgi/andrew.txt', { |
dojo.xhrGet({ |
method: 'get', |
url: base_url, |
onSuccess: function(response) { |
node: dojo.byId("files"), |
document.getElementById('files').innerHTML = response.responseText; |
load: loadIntoNode |
} |
}); |
}); |
|
} |
} |
function getList(list) { |
function getList(list) { |
document.getElementById('list').innerHTML = "Getting List . . ."; |
dojo.byId('list').innerHTML = "Getting List . . ."; |
new Ajax.Request('/~andrew/user-bin/todo.cgi/andrew/' + list + '.txt', { |
dojo.xhrGet({ |
method: 'get', |
url: base_url + '/' + list + '.txt', |
onSuccess: function(response) { |
node: dojo.byId("list"), |
document.getElementById('list').innerHTML = |
load: loadIntoNode |
'<pre>' + response.responseText + '</pre>'; |
}); |
} |
|
}); |
|
} |
} |
function getEntry(list, entry) { |
function getEntry(list, entry) { |
document.getElementById('entry').innerHTML = "Getting Entry . . ."; |
document.getElementById('entry').innerHTML = "Getting Entry . . ."; |
new Ajax.Request('/~andrew/user-bin/todo.cgi/andrew/' + list + '/entry/' + entry + '.md5', { |
dojo.xhrGet({ |
method: 'get', |
url: base_url + '/' + list + '/entry/' + entry + '.md5', |
onSuccess: function(response) { |
node: dojo.byId("entry"), |
document.getElementById('entry').innerHTML = |
load: loadIntoNode |
'<pre>' + response.responseText + '</pre>'; |
}); |
} |
|
}); |
|
} |
} |
</script> |
</script> |
</head> |
</head> |
<body onLoad="getFiles();getList('todo');getEntry('todo',5)"> |
<body onLoad="getFiles();getList('todo');getEntry('todo',5)"> |
<!-- $AFresh1$ --> |
|
|
<!-- $AFresh1: index.html,v 1.3 2010/01/19 03:33:13 andrew Exp $ --> |
<div id='files'></div> |
<div id='files'></div> |
<div id='list'></div> |
<pre><div id='list'></div></pre> |
<div id='entry'></div> |
<div id='entry'></div> |
</body></html> |
</body></html> |