**文書の過去の版を表示しています。**
ajaxでサーバにファイルをPOSTした後、完了画面に遷移
- javascriptでは
window.location.replace(“redirect先のURL”);
でリダイレクトを行うことができる。(https://living-sun.com/ja/php/648936-return-a-view-or-redirect-after-ajax-request-php-jquery-ajax-laravel-redirect.html) - ajaxのPOSTが成功した時の処理にこれを加えればよい。(https://qiita.com/tonkotsuboy_com/items/0722ad92f370ab0c411b)
index.pug
$.ajax({ type: "POST", url: "./upload/", data: formData, processData: false, contentType: false, }) .done(function(res){ window.location.replace("./uploaded/"); console.log("success"); }) .fail(function(res){ console.log("falied"); });
javascriptの場合スクリプトの位置からの相対パスでファイルの位置を記述できる(https://web-designer.cman.jp/other/path/)