Using Jquery/Json to get values onblur in a form?

Discussion in 'jQuery' started by mokimofiki, May 25, 2011.

  1. #1
    I have a form in which zipcode is a field. I'm trying to pull related information about that zipcode from a web service database to be inserted into a hidden field before the form is submitted. The call URL is http://muzak-dealers.heroku.com/dea...26F777D-EA30-4F15-B956-648662E34F17&callback= so 28031 would change based on the user's input. Out of what is returned from this URL I need the value for ia_or_oa.

    This is an example of what is returned:
    ({"_id":"4da5c6d3b5d2ac56ac002d6b","city":"CORNELIUS","ia_or_oa":"O","name":"MUZAK-MIDATLANTIC-CHARLOTTE","number":"432828","state":"NC","zip":"28031"})
    Code (markup):

     
    mokimofiki, May 25, 2011 IP
  2. Jan Novak

    Jan Novak Peon

    Messages:
    121
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    0
    #2
    You will get the value by this way:

    
    variable=({"_id":"4da5c6d3b5d2ac56ac002d6b","city":"CORNELIUS","ia_or_oa":"O","name":"MUZAK-MIDATLANTIC-CHARLOTTE","number":"432828","state":"NC","zip":"28031"})
    alert(variable.ia_or_oa)
    
    Code (markup):
     
    Jan Novak, May 26, 2011 IP