Your are on the right track but have to tweak a few things.
Your javascript needs (in best case) an object as result and if you want to see the result comming from PHP your js has to handle that. A quick test would be to make a console log – just to check if it works.
Try editing your code like this and check in your browser console:
// PHP file:
function test() {
$result = array(0 => 'Testresult from Ajax 1', 1 => 'Testresult from Ajax 2');
header('Content-Type: application/json');
die (json_encode($result));
}
Then in your js:
// JS file:
function yes() {
var obj = {
url: ajaxurl,
type: 'POST',
data: {
action: 'test_function'
},
dataType: 'JSON',
cache: false
};
jQuery.ajax(obj)
.done(function( data ) {
console.log('result is: ', data);
});
};
If it works you can handle you results in the done() function, for example write stuff into the dom or whatever.