I want to convert json data and put the return values into javascript array. I use jquery version 1.9.1
jquery:
$('#searchinput').on('keyup', function(){
$value2=$(this).val();
$.ajax({
type: 'get',
url: '{{URL::to('search')}}',
data: {'thesearch':decodeURIComponent($value2)},
success:function(game){
alert(JSON.stringify(game));
}
});
});
That gives the result:
[{"name":"First name"},{"name":"Second Name"}]
What I want is to store the values into javascript array like this:
var namearray = ['First name', 'Second Name'];
How to do that?