fix returning json data from XMLHttpRequest