Update main.js

Change in handler of ajax response and redirect to search page