Replace link_to_function with UJS based code