added code to fetch result via ajax

TODO:fix encoding bugs