KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am a complete noob with JSON parsing in jQuery. Thought I got the response... My data is in this form: Array( [1]=>abc, [3]=>mango, [4]=>apple, [5]=>fruits ) In this way I want this list to appear as an autocomplete list. I am using. jQuery("#name").autocomplete( '<?php echo HTTP_PATH.'/songs/sss'; ?>', { multiple: true, mustMatch: true, matchContains: true, autoFill: false, dataType: "json", parse: function(data) { return jQuery.map(data, function(item) { return { data: item, value: item.label, result: item.label}; }); }, formatItem: function(item) { return item.label; }, formatResult: function(item) { return item.id; }, formatMatch: function(item) { return item.label; } }); I want the value when it shows list, i.e. the label from my data. When I select a label then it should show the label. But at the time of submission it should actually submit the key. I mean I want it to work as select box of HTML. Returned JSON [{"id":1,"label":"Mehdi Hassan"},{"id":2,"label":"Jagjit Singh"},{"id":3,"label":"Suresh Vadekar"}]
Tags (comma-separated)
Save Edits
Cancel