update script for handling the json/html result