1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MODXのDittoで処理が終わるまでローディング画面を表示する

Last updated at Posted at 2015-12-01

MODX上でDittoでデータを抽出する場合、時間がかかる場合があります。
jQueryなどでローディング画面を表示しようと思っても、Dittoから処理が帰ってくるまで、画面表示が切り替わらないので、ローディング画面が表示できません。

そのような場合は別にローディング画面用のリソースを用意して、そこからjavascriptで本来表示したい結果ページヘリダイレクトする方法があります。
ただし、スクリプトはチャンクにして呼び込まないとリダイレクトしないようです。

例---

{{ロード後リダイレクト}}

<SCRIPT type="text/javascript">
setTimeout("link()", 1000);
function link(){
location.href="[~**~]";
}
</SCRIPT>

上記は1秒後にリダイレクトになっていますが、実際は1秒後でなくDittoの処理が終わるとリダイレクトします。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?