Hello Chad,
your coding looks ok (although with that little crazy URL determination ).
Did you check if your request has the payload?
Does the "undefined" message really occur for the $.request.body object or do you have further coding which could lead to the error?
Regards,
Florian