-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjquery.template-ajax.html
73 lines (54 loc) · 2.17 KB
/
jquery.template-ajax.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>untitled</title>
<!-- Stylesheets -->
<link rel="stylesheet" href="" type="text/css">
<style type="text/css" media="screen">
</style>
<!-- JavaScripts -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.template-ajax.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="output"></div>
<script type="text/javascript" charset="utf-8">
foo = 'bar';
(function () {
var s, tpl,
elem = $('#output'),
url = 'http://assets.dev/js/jquery/plugins/template/jquery.template-ajax.tpl',
bar = 'baz';
var dave = {
name: 'Dave Furfero',
jobs: [
{company:'MLB.com', position:'User Interface Engineer', start:'March 2009', end:'present'},
{company:'Time, Inc.', position:'Front-end Developer', start:'July 2008', end:'March 2009'},
{company:'Live Nation', position:'Director of Product Development', start:'February 2008', end:'July 2008'},
{company:'Live Nation', position:'Senior Product Developer', start:'August 2007', end:'February 2008'},
{company:'Owl Music Search', position:'Interface Design Director', start:'April 2006', end:'June 2007'}
]
};
var henry = {
name: 'Henry Chan',
jobs: [
{company:'Time, Inc.', position:'Front-end Developer', start:'July 2008', end:'March 2009'},
{company:'Live Nation', position:'Junior Product Developer', start:'August 2007', end:'February 2008'}
]
};
$.template(url, dave).appendTo(elem);
elem.append('<hr/>');
$.template(url, [dave, henry]).appendTo(elem);
var text = $.template(url, dave);
console.log(text);
var text = $.template(url, [dave, henry]);
console.log(text);
var text = $.template(url, dave, true);
console.log(text);
var text = $.template(url, [dave, henry], true);
console.log(text);
})();
</script>
</body>
</html>