Added the 'dataType' parameter to $.ajax calls to ensure we treat the response correctly.