diff --git a/portfolio/download/file.php b/portfolio/download/file.php
index 0e10dd900d634..37591f955138c 100644
--- a/portfolio/download/file.php
+++ b/portfolio/download/file.php
@@ -25,8 +25,6 @@
$returnurl = $exporter->get('caller')->get_return_url();
echo $OUTPUT->notification('' . get_string('returntowhereyouwere', 'portfolio') . '
');
-$PAGE->requires->js('/portfolio/download/helper.js');
-$PAGE->requires->js_function_call('submit_download_form', null, true);
// if they don't have javascript, they can submit the form here to get the file.
// if they do, it does it nicely for them.
@@ -35,6 +33,13 @@
';
+
+$PAGE->requires->js_amd_inline("
+require(['jquery'], function($) {
+ $('#redirectform').submit(function() {
+ $('#redirect').addClass('hide');
+ }).submit();
+});");
echo $OUTPUT->footer();
diff --git a/portfolio/download/helper.js b/portfolio/download/helper.js
deleted file mode 100644
index a2d920e45ee84..0000000000000
--- a/portfolio/download/helper.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function submit_download_form() {
-YUI().use('yui2-dom', function(Y) {
- f = Y.YUI2.util.Dom.get("redirectform");
- Y.YUI2.util.Dom.addClass(f.parentNode, "hide");
- f.submit();
-});
-}