I was reading several posts about this, and make some changes to my code but no luck.
Can anyone look into this, to see what's going on here? Or perhaps another way to do what I need (retrieve city, state by a zip code using ziptastic)
The code works fine in Chrome (http://jsfiddle.net/7VtHc/117/
)
html
<asp:TextBox ID="txtZipCode" runat="server"></asp:TextBox>
<asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
<asp:TextBox ID="txtState" runat="server"></asp:TextBox>
script
<script src="http://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("input[id$='txtZipCode']").keyup(function () {
var el = $(this);
if (el.val().length === 5) {
$.ajax({
url: "http://zip.getziptastic.com/v2/US/" + el.val(),
cache: false,
dataType: "json",
type: "GET",
success: function (result, success) {
$("input[id$='txtCity']").val(result.city);
$("input[id$='txtState']").val(result.state);
}
});
}
});
});
</script>
Thanks,