The search terms are now correctly encoded into json and passed to the js code and correctly decoded on that end.