On Dropdown Selection, how to fill complete form fields from Database

前端 未结 2 345
耶瑟儿~
耶瑟儿~ 2021-01-03 08:41

How to fill the complete form input fields from Database based on the value selected from the Dropdown

Example: In a Application, by selecting a client name it fills

2条回答
  •  孤城傲影
    2021-01-03 09:25

    When you made ajaxCall return data in json format like

    json_encode(array("phone"=>'123-12313',"email"=>'test@test.com','city'=>'Medicine Hat','address'=>'556 19th Street NE'));
    

    above shown

    then parse it in jQuery and put the value in different selectors like

     var Vals    =   JSON.parse(response);
     // These are the inputs that will populate
     $("input[name='phone']").val(Vals.phone);
    

    above shown.

提交回复
热议问题