Skip to content

Commit a505bdd

Browse files
committed
jquery for postcode lookup
1 parent 66fddff commit a505bdd

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

_images/logo2.psd

334 Bytes
Binary file not shown.

_layouts/default.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<link href='http://fonts.googleapis.com/css?family=Droid+Serif' rel='stylesheet' type='text/css'>
1010
<link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
1111

12+
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
13+
1214
<!-- syntax highlighting CSS -->
1315
<link rel="stylesheet" href="/css/syntax.css">
1416

@@ -33,16 +35,16 @@
3335
<div style='clear:both;'></div>
3436
</div>
3537
<div class="col-md-2 getcode">
36-
<p><a href='https://github.com/tfgg/yournextmep'>Contribute on Github</a></p>
38+
<p><a href='https://github.com/tfgg/yournextmep' target="_blank">Contribute on Github</a></p>
3739
</div>
3840
</div>
3941

4042
{{ content }}
4143

4244
<div class='row footer'>
4345
<div class='col-md-12'>
44-
<p class="text-warning">This site is under construction (you could probably guess that). Help contribute information about MEP candidates <a href='https://github.com/tfgg/yournextmep'>on Github</a> or <a href='mailto:[email protected]'>email me</a> or <a href='http://twitter.com/tfgg2'>follow me on Twitter</a>.</p>
45-
<p>Postcode lookup service from <a href='http://mapit.mysociety.org/'>MapIt</a> by <a href='http://www.mysociety.org/'>mySociety</a>.</p>
46+
<p class="text-warning">This site is under construction (you could probably guess that). Help contribute information about MEP candidates <a href='https://github.com/tfgg/yournextmep' target="_blank">on Github</a> or <a href='mailto:[email protected]'>email me</a> or <a href='http://twitter.com/tfgg2' target="_blank">follow me on Twitter</a>.</p>
47+
<p>Postcode lookup service from <a href='http://mapit.mysociety.org/' target="_blank">MapIt</a> by <a href='http://www.mysociety.org/' target="_blank">mySociety</a>.</p>
4648
</div>
4749
</div>
4850
</div>

index.html

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,33 @@
33
title: YourNextMEP
44
---
55

6+
<script>
7+
$(document).ready(function(){
8+
var form = $('form#postcode-form');
9+
10+
form.submit(function() {
11+
$.post('/api/postcode', form.serialize(),
12+
function(data) {
13+
alert(data);
14+
});
15+
16+
return false;
17+
});
18+
});
19+
</script>
20+
621
<div class="row">
722
<div class="col-md-12">
8-
<h1>UK EU election regions</h1>
9-
<form action='/api/postcode' method='POST' class='form-inline'>
10-
<input type="text" placeholder="enter your postcode">
11-
<button type="submit" class="btn">Find region</button>
23+
<form action='/api/postcode' method='POST' role="form" class='form-inline' id='postcode-form'>
24+
<div class="form-group">
25+
<label class="sr-only" for="postcode">Postcode</label>
26+
<input name="postcode" class="form-control" type="text" placeholder="enter your postcode">
27+
</div>
28+
<button type="submit" class="btn btn-default">Find region</button>
1229
</form>
13-
30+
</div>
31+
<div class="col-md-12">
32+
<h1>UK EU election regions</h1>
1433
<ul class="regions">
1534
{% for region in site.pages %}
1635
{% if region.layout == 'region' %}

0 commit comments

Comments
 (0)