I have an array
{
"status": "OK",
"message": "Data Show Successful",
"allknife": [
{
"name": "Folder",
"notes": ""
},
{
"name": "Folder2",
"notes": ""
}
}
]
}
My current code run correctly
my current code
<script>
$(document).ready(function() {
$("#person").change(function () {
var val = $(this).val()
if(val == "") return
$.getJSON("http://some.com/Knife/api/l.php?&returnformat=json", {"state":val}, function(res,code) {
$("#name").val(res.message)
$("#age").val(res.status)
})
})
})
</script>
now i want to populate my select box value from allknife array every array name.
like
<option value="folder">0</option>
<option value="folder2">1</option>
here value 0 and ones means folder is 1st array o allknife
when user select #person select box then other fields of form fill with mycurrent code then when user select second select box 0 then other fields fill.
if they select folder then other filed fill from allknife o no array. if folder2 then other field fill from allknife array 2
my form looks like
<form>
<select name="person" id="person">
<input type="text" name="name" id="name"><br/>
<input type="text" name="age" id="age"><br/>
<select id="allknife"></select>
<input type="text" name="name" id="name"><br/>
<input type="text" name="note" id="note"><br/>
<input type="text" name="codskill" id="codskill"><br/>
</form>