jQuery how to load some json records into a form fields?

后端 未结 4 1939
心在旅途
心在旅途 2020-12-09 00:29

i have a json file:

 {
    \"data\": \"Click\",
    \"size\": \"Here\"    }

and a form:

First name:
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 01:02

    You may also use $.get like below;

    $.get('your_file.[php/json]',function(d){
        $("input[name='firstname']").val(d.data);
        $("input[name='firstname']").val(d.size);
    },'json');
    

提交回复
热议问题