better ajax handling on node and client side (hoepfully)