I'm not sure... does it work?
Maybe add:
$respObj = json_decode($resp );
var_dump($respObj);
die();
if ($respObj->success && $respObj->action == 'homepage') {
I thought we changed the action to login? Adding the debug code should help you see what the action is so you can test it's value correctly.