weixin_33691598 2018-03-24 14:30 采纳率: 0%
浏览 14

用.getJSON填写表格

I want to fill form inputs with JSON encoded data from ajax. My jQuery code is

$('#event_id').blur(function(){
    $.getJSON('../ajax/regattaformAjax.php', fetchOld);
    function fetchOld(data){
        $.each(data, function(label, value){
            $('[#'+label+']',data).val(value);
        });
    }
});

and the JSON-encoded data from regattaformAjax.php is

{"Address":"1717 88th Dr SE","Chevrons":"Black","City":"Lake Stevens","Class":"IOM","ClubAMYA#":"132"}

There are no errors in the console. Where did I go astray?

  • 写回答

0条回答 默认 最新

    报告相同问题?