For example, I have JavaScript array like this:
var data = [
{text:'Business', aid:'6'},
{text:'Careers', aid:'29'},
{text:'Credits', aid:'28'},
{text:'Insurance', aid:'30'}
];
Now, in URl is passed ID and I need to grab 'text' from this array based on that ID like:
$('#category').val(data, function(item) {return item.aid['6'].text;} ); // = Business
So I want to populate form field #category with text from array based on passed URL ID = aid?
Thanks in advance