json not populating fields
Hello sir
This might be silly question.
I can populate the form fields using JSON
I select a client from dropdown
and based on its value (id) i call JSON and populate the respective fields
what if the the
client id selected from dropdown is zero (normally starting item with id=0 like pleases select) )
My Json
where to put the initialization code so as to blank the fields populated earlier
- $('#clientid').change( function() { //change ID when selected from dropdown
- alert( $('#clientid').val()); // correct value of client id is displayed
- $.getJSON("clientreadjsonfill.php", {id: $('#clientid').val()}, function(data){
- $('#buildingname').val(data['buildingname']); // populate data working
- $('#roomno').val(data['roomno']);
- $('#streetname').val(data['streetname']);
- $('#location').val(data['location']);
- $('#landmark').val(data['landmark']);
- $('city').val(data['city']);
- }).done(function(){
- $('#aaa').text('xxx'); // xxx is populated in div with id aaa
-
- });
- });