Skip to content

Instantly share code, notes, and snippets.

@cj
Created June 22, 2010 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cj/449123 to your computer and use it in GitHub Desktop.
Save cj/449123 to your computer and use it in GitHub Desktop.
bind_search_license: function(){
$("#search-license").click(function(){
var t$ = $("#shop_license");
$.ajax({
type:'get',
dataType:'json',
url:'/auth/search_license',
cache:false,
data:{ license: t$.val() },
success: function(){
alert("moo");
var form$ = $("#signup-form");
function filter(results,old_key){
_(results).each(function(value,key){
if(typeof value == "object")
filter(value,key);
else{
if(old_key){
pre_key = key;
key = old_key;
}
switch(key){
case "address":
form$.find('[name=shop_address['+pre_key+']]').val(value);
break;
default:
form$.find('[name=shop_'+key+']').val(value);
break;
}
}
});
}
if( r.total >=1 ){
filter(r.results[0]);
}
form$.find("input[type=text]").removeAttr("disabled").removeClass("disabled");
$('#shop-phone').mask("(999) 999 - 9999");
$('#shop-zip').mask("99999");
}
})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment