How to select an option of a combobox from ajax that has different option values?

How to select an option of a combobox from ajax that has different option values?

(Note: although I mentioned Magento, this is NOT a Magento question, it's about jquery).

I have a form and I've used a jquery script to autocomplete address based on zip code. The problem is that Magento brings a state/region list which values are different than I got from ajax result (webservice). For example: the value returned for state is "SP" (Sao Paulo) and the value that should match in select is "508" instead of "SP". How to populate that select correctly?

See the select here (Magento generates it dinamically, from db):

  1. <select id="region_id" name="region_id" title="Estado" class="validate-select required-entry" defaultvalue="">
  2.     <option value="">Selecione o Estado...</option>
  3.     <option value="485">Acre</option>
  4.     <option value="486">Alagoas</option>
  5.     <option value="487">Amapá</option>
  6.     <option value="488">Amazonas</option>
  7.     <option value="489">Bahia</option>
  8.     <option value="490">Ceará</option>
  9.     <option value="511">Distrito Federal</option>
  10.     <option value="491">Espírito Santo</option>
  11.     <option value="492">Goiás</option>
  12.     <option value="493">Maranhão</option>
  13.     <option value="495">Mato Grosso do Sul</option>
  14.     <option value="494">Mato Grosso</option>
  15.     <option value="496">Minas Gerais</option>
  16.     <option value="499">Paraná</option>
  17.     <option value="498">Paraíba</option>
  18.     <option value="497">Pará</option>
  19.     <option value="500">Pernambuco</option>
  20.     <option value="501">Piauí</option>
  21.     <option value="503">Rio Grande do Norte</option>
  22.     <option value="504">Rio Grande do Sul</option>
  23.     <option value="502">Rio de Janeiro</option>
  24.     <option value="505">Rondônia</option>
  25.     <option value="506">Roraima</option>
  26.     <option value="507">Santa Catarina</option>
  27.     <option value="509">Sergipe</option>
  28.     <option value="508">São Paulo</option>
  29.     <option value="510">Tocantins</option>
  30. </select>

I have no idea how to "associate" each option number with the possible results from ajax.

Any helps?