The javascript event you're looking for is orientationchange. You can watch for this with the jQuery on method.
$(window).on('orientationchange',updateDisplay);
The handler method will look at the window.orientation to figure out if it's portrait or landscape.
if(Math.abs(window.orientation) === 90){ // landscape: do stuff } else{ // portrait: do stuff }
You can see an example here.