Skip to content

Instantly share code, notes, and snippets.

@fritids
Created January 26, 2014 12:55
Show Gist options
  • Save fritids/8632270 to your computer and use it in GitHub Desktop.
Save fritids/8632270 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Petitions Revisited</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<h1>Petitions Revisited</h1>
<form id="searchform" method="post">
<div>
<label for="zip">Zip code</label>
<input type="text" name="zip" id="zip" />
<input type="submit" value="Submit" id="cosponsor_check_button" />
</div>
</form>
<div id="petition_box"></div>
<script type='text/javascript'>
$(document).ready(function(){
$("#petition_box").slideUp();
$("#cosponsor_check_button").click(function(e){
e.preventDefault();
ajax_request();
});
});
function ajax_request(){
$("#petition_box").show();
var search_val = $("#zip").val();
$.post("./cosponsorship-check.php", { zip: search_val }, function(data){
if (data.length>0){
$("#petition_box").html(data);
}
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment