Skip to main content
Active reading.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

The JSON Formatformat:

[{ "org_name": "Asset Management" }, { "org_name": "Debt Equity Foreign services" }, { "org_name": "Credit Services" }] 

And the JqueryjQuery code to populate the values to the Dropdown on ajaxAjax success:

success: function(json) {  var options = [];  $('#org_category').html(''); // Set the Dropdown as Blank before new Data  options.push('<option>-- Select Category --</option>');  $.each(JSON.parse(json), function(i, item) {   options.push($('<option/>',    {   value: item.org_name, text: item.org_name    })); });   $('#org_category').append(options); // Set the Values to Dropdown } 

The JSON Format:

[{ "org_name": "Asset Management" }, { "org_name": "Debt Equity Foreign services" }, { "org_name": "Credit Services" }] 

And the Jquery to populate the values to the Dropdown on ajax success:

success: function(json) { var options = []; $('#org_category').html(''); // Set the Dropdown as Blank before new Data options.push('<option>-- Select Category --</option>'); $.each(JSON.parse(json), function(i, item) { options.push($('<option/>',  { value: item.org_name, text: item.org_name  })); }); $('#org_category').append(options); // Set the Values to Dropdown } 

The JSON format:

[{ "org_name": "Asset Management" }, { "org_name": "Debt Equity Foreign services" }, { "org_name": "Credit Services" }] 

And the jQuery code to populate the values to the Dropdown on Ajax success:

success: function(json) {  var options = [];  $('#org_category').html(''); // Set the Dropdown as Blank before new Data  options.push('<option>-- Select Category --</option>');  $.each(JSON.parse(json), function(i, item) {   options.push($('<option/>',   {   value: item.org_name, text: item.org_name   })); });   $('#org_category').append(options); // Set the Values to Dropdown } 
Source Link
M J
  • 3k
  • 4
  • 26
  • 36

The JSON Format:

[{ "org_name": "Asset Management" }, { "org_name": "Debt Equity Foreign services" }, { "org_name": "Credit Services" }] 

And the Jquery to populate the values to the Dropdown on ajax success:

success: function(json) { var options = []; $('#org_category').html(''); // Set the Dropdown as Blank before new Data options.push('<option>-- Select Category --</option>'); $.each(JSON.parse(json), function(i, item) { options.push($('<option/>', { value: item.org_name, text: item.org_name })); }); $('#org_category').append(options); // Set the Values to Dropdown }