$( function() {
	if ( !mw.pageTriage ) {
		mw.pageTriage = {};
	}
	mw.pageTriage.viewUtil = {
		// fetch and compile a template, then return it.
		// args: view, template
		template: function( arg ) {
			apiRequest = {
				'action': 'pagetriagetemplate',
				'view': arg.view,
				'format': 'json'
			};

			var templateText;
			
			if( arg.template instanceof Array ) {
				apiRequest.template = arg.template.join('|');
			} else {
				apiRequest.template = arg.template;
			}
			
			$.ajax( {
				type: 'post',
				url: mw.util.wikiScript( 'api' ),
				data: apiRequest,
				dataType: 'json',
				async: false,
				success: function( result ) {
					if( result.pagetriagetemplate.result == 'success' ) {
						templateText = result.pagetriagetemplate.template;
					}						
				}
			} );

			return _.template( templateText );
		}
	};
} );

@@ -647,17 +647,61 @@
 %0A%09%09%09%09%09if
+ 
 (
+ result.pagetriagetemplate !== undefined &&
  result.
@@ -728,16 +728,17 @@
 esult ==
+=
  'succes
@@ -807,22 +807,16 @@
 ;%0A%09%09%09%09%09%7D
-%09%09%09%09%09%09
 %0A%09%09%09%09%7D%0A%09

Make sure some results were returned to avoid error.