php - using json object data in jquery select -


{"names": [     {"patientname": "ratna"},     {"patientname": "raju" },     {"patientname": "krishna"},     {"patientname": "kishore"},     {"patientname": "kishore1"},     {"patientname": "mahesh"} ]} 

this json object i'm getting ajax call want add patientname values select box through jquery

can 1 tell me how accomplish ??

here i'm using $.ajax() function ajax call

thanks in advance

var select = $('#selectid'); $.each(data.names, function(i, v){     select.append('<option value="'+v.patientname+'">'+v.patientname+'</option>'); } 

doc - $.each(), .append()

fiddle


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -