-
Notifications
You must be signed in to change notification settings - Fork 0
/
mashup.html
41 lines (36 loc) · 1.15 KB
/
mashup.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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
var baseUrl = 'http://localhost:8080';
$(function() {
function interceptClick (selector, url) {
$(selector).click(function(e) {
e.preventDefault();
window.location = url + $(this).attr('href');
});
}
$.ajax(baseUrl + '/bbc').success(function(data) {
$('#bbc').html(data);
interceptClick('#bbc a', 'http://www.bbc.co.uk');
})
$.ajax(baseUrl + '/sky').success(function(data) {
$('#sky').html(data);
interceptClick('#sky a', 'http://news.sky.com/');
})
})
</script>
<div class="col-md-6">
<h2>BBC top news</h2>
<div id="bbc"></div>
</div>
<div class="col-md-6">
<h2>Sky top news</h2>
<div id="sky"></div>
</div>
</body>
</html>