Created
June 22, 2010 21:29
-
-
Save cj/449123 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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