Skip to content

Instantly share code, notes, and snippets.

@adamdilek
Created January 12, 2012 18:51
Show Gist options
  • Select an option

  • Save adamdilek/1602351 to your computer and use it in GitHub Desktop.

Select an option

Save adamdilek/1602351 to your computer and use it in GitHub Desktop.
Jquery Example for Validation API
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#submit').click(function() {
var tc=$("#tc").val();
request = 'http://pigon.ws/validation/tc?tcno='+tc+'&callback=?';
get(request, tc);
var credit_card_no=$("#ccno").val();
request = 'http://pigon.ws/validation/credit_card?ccno='+credit_card_no+'&callback=?';
get(request, credit_card_no);
var email=$("#email").val();
request = 'http://pigon.ws/validation/email?email='+email+'&callback=?';
get(request, email);
var url=$("#url").val();
request = 'http://pigon.ws/validation/url_checker?url='+url+'&callback=?';
get(request, url);
var ip=$("#ip").val();
request = 'http://pigon.ws/validation/ip_checker?ip='+ip+'&callback=?';
get(request, ip);
});
});
function get(request, input){
$.getJSON(request,
function(data){
$.each(data, function(i,item){
$('#message').append("<p>"+input+" is "+item+"</p>");
});
});
}
</script>
</head>
<body>
Tc : <input type="text" name="tc" id="tc"><br>
Credit Card No: <input type="text" name="ccno" id="ccno"><br>
Email : <input type="text" name="email" id="email"><br>
Url : <input type="text" name="url" id="url"><br>
Ip : <input type="text" name="ip" id="ip"><br>
<input type="submit" name="submit" id="submit" value="submit">
<div id="message"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment