Handle smart ajax requests