Page 1 of 1

Postal no. -> City (Howto?)

Posted: Wed Apr 14, 2010 12:41 am
by MrConn
The Norwegian postalservice has got a great little app that I would like to implant into my opencart-installation...

This code automatically fills out City based on the postalcode (Norwegian only!)

Code: Select all

<script src=""></script>

<script type="text/javascript">
   $(document).ready(function() {
      inputField = $('#postnummerInput');
      outputElement = $('#postnummerResult');
      inputField.keyup(function() {
         if (inputField.val().length == 4) {
            $.getJSON(''+ inputField.val() +'&callback=?',
         else {
   <input type="text" id="postnummerInput" style="width: 4em;"/>  <span id="postnummerResult"> </span>
The code can be seen here
But as you can see the code only gives the city ("postnummerResult") out as a span... How can I get the output in a text-field?