On 1/22/07, Matt Stith <[EMAIL PROTECTED]> wrote:
> getJSON eval's the results automatically, so theres no need to eval it
> yourself.

Hi Matt,

thanks for the advice, i've streamlined the script a bit but still
doesn't work... dunno why but i can't write to the document in the
#results div

Any idea?

Thanks,
Lorenzo

<html>
<head>
<title>Ajax test</title>
<script type="text/javascript" src="/site-media/jquery.js"></script>
<script type="text/javascript">
function find_cities(city_name)
{       var city_name = city_name;
        $.getJSON('city_search/' + city_name + "/",
                
                function(json)
                {       
                        for(i=0;i<10;i++)
                        {
                                results = $('#results').val() +
$('#results').text(json[i].fields['city'] + "<br />");
                        }
                }
        
        );
}

</script>
</head>
<body>

<form action="" method="post">
        City search: <input type="text" name="city" value="" id="city"
onkeyup="find_cities($('#city').val());" />
        <input type="submit" value="Submit" />
</form>

<div id="results">

</div>

</body>
</html>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to