ํ์ธ ๋๋ ์ค๋ฅ ๋ฒํผ์ ํด๋ฆญํ ํ ๋ค๋ฅธ ํ์ด์ง๋ก ์ด๋ํด์ผ ํฉ๋๋ค... ๋ด ์ฝ๋:
ํ์ด์ง๊ฐ ๋ก๋๋ ๋ ์ค๋ฅ๋ฅผ ํ์ํด์ผ ํ๊ธฐ ๋๋ฌธ์ $(document)๋ฅผ ์ฌ์ฉํฉ๋๋ค.
๋์์ฃผ์ธ์ ;)
location.href = 'http://google.com'
์ฌ์ฉํ์ฌ ์ํํ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
์ด๊ฒ์ ํ์ธ/์ค๋ฅ ๋ฒํผ ํด๋ฆญ ํธ๋ค๋ฌ์์ ํธ์ถ๋์ด์ผ ํฉ๋๋ค.
@technofreaky๊ฐ ๋งํ๋ฏ์ด JavaScript๋ฅผ ์ฌ์ฉํ์ฌ ๋ฆฌ๋๋ ์ ํ ์ ์์ต๋๋ค. ๋ค์์ ์ ์ฌํ ์์ ๋๋ค. https://github.com/t4t5/sweetalert/issues/168
ํด๊ฒฐํ ์ ์์ด์ :)
window.location.href ๋ง ์ฌ์ฉํ์ญ์์ค. ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
$(document).ready(function() {
swal({
title: "Error",
text: "wrong user or password",
type: "error"
},
function(){
window.location.href = 'login.html';
});
});
๋์์ค์ ๊ณ ๋ง์
@fabianchoxD ์
๋ฌ์ฝคํ ๊ฒฝ๊ณ ๋ด์์ html ํ์ด์ง๋ฅผ ๋ฐ์ธ๋ฉํด์ผ ํฉ๋๋ค. ๋ด ๋ฌ์ฝคํ ๊ฒฝ๊ณ ๊ฐ ํธ๋ฆฌ๊ฑฐ๋๋ฉด ๋ณธ๋ฌธ์ html ํ์ด์ง๊ฐ ํ์๋์ด์ผ ํฉ๋๋ค.
์ฌ์ฉ์๊ฐ SweetAlert๋ก ๋ธ๋ผ์ฐ์ /ํญ์ ๋ซ์ผ๋ ค ํ ๋ ์ด๋ป๊ฒ ๊ฒฝ๊ณ ๋ฅผ ํ์ํ ์ ์์ต๋๊น? ๋์์ฃผ์ธ์..
@fabianchoxD ๊ฐ์ฌํฉ๋๋ค. ์๋ํฉ๋๋ค.
persistant()
ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ์์ฑ๋ OK
๋ฒํผ์ ํด๋ฆญํ ๋ ํธ๋ฆฌ๊ฑฐ๋๋ ์ฝ๋ฐฑ ํจ์/์ด๋ฒคํธ์ ๋ํด ์๋ ์ฌ๋์ด ์์ต๋๊น?
Alert::success('Success Message', 'Optional Title')->persistent("Ok");
@fabianchoxD ์๋ฃจ์
์ ๊ฐ์ฌํ์ง๋ง ์ ์๊ฒ๋ ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ํด๊ฒฐํ ์ ์์์ต๋๋ค.
์ค์({
์ ๋ชฉ: "์ฑ๊ณต!",
ํ
์คํธ: ์๋ต.์คํฌ๋ฆฝํธ ์ํ,
์ ํ: "์ฑ๊ณต"
}).then(ํจ์() {
// ์ฌ์ฉ์ ๋ฆฌ๋๋ ์
window.location.href = "new_url.html";
console.log('ํ์ธ ๋ฒํผ์ ๋๋ ์ต๋๋ค.');
});
@cnchg ๋ง์ ๊ฐ์ฌ, ๊ทธ๊ฒ์ ๋๋ฅผ ์ํด ์ผํฉ๋๋ค!!!
๋ชจ๋ฌ์ "์ทจ์" ๋ฒํผ๋ ์๋ ๊ฒฝ์ฐ "ํ์ธ" ๋ฒํผ์ด ์ค์ ๋ก ๋๋ ธ๋์ง ํ์ธํ๊ณ ์ถ์ ๊ฒ์ ๋๋ค.
swal({...}).then(okay => {
if (okay) {
window.location.href = "...";
}
});
swal({
icon: "error",
title: "ยกError!",
showConfirmButton: true,
confirmButtonText: "Cerrar",
closeOnConfirm: false
}). then(function(result){
window.location = "WEREYOUWANTTOGO";
})
์ด๊ฒ์ด ์ด ๋ฌธ์ ์ ๋ํ ๋์ ํด๊ฒฐ์ฑ ์ ๋๋ค!
ํจ์ MessageWarning($message,$text,$icon,$sure,$url){
์์ฝ"
swal({
title:\"$mesaj\",
text:'$text',
icon:'$icon',
button:'Kapat'
});
";
header("Refresh: $sure; url=$url");
//location.href = 'http://www.alokatalog.com/'
//$gidecekSiteAdres= header('location:'.$_SERVER['HTTP_REFERER']);
}
MesajUyari("Proje Oluลturma Baลarฤฑlฤฑ","Yรถnlendiriliyorsunuz
Lรผtfen Bekleyin","success",3,"Sayfa.php");/
@fabianchoxD ์๋ฃจ์ ์ ๊ฐ์ฌํ์ง๋ง ์ ์๊ฒ๋ ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ํด๊ฒฐํ ์ ์์์ต๋๋ค.
์ค์({
์ ๋ชฉ: "์ฑ๊ณต!",
ํ ์คํธ: ์๋ต.์คํฌ๋ฆฝํธ ์ํ,
์ ํ: "์ฑ๊ณต"
}).then(ํจ์() {
// ์ฌ์ฉ์ ๋ฆฌ๋๋ ์
window.location.href = "new_url.html";
console.log('ํ์ธ ๋ฒํผ์ ๋๋ ์ต๋๋ค.');
});
๊ฐ์ฌ ํด์!! ํจ๊ณผ๊ฐ ์์๋ค!!
๊ด์ฐ์ ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ํ์ํ์ง ์๊ณ ํ์ด์ง๋ก ์ง์ ๋ฆฌ๋๋ ์ ๋ฉ๋๋ค. ํฌ๋กฌ์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
swal({
title: "App",
text: "Error: Invalid Credentials, try again !",
icon: "error",
closeOnConfirm: false
}).then(
function () {
window.location.href = 'index.html';
}
);
์๋
ํ์ธ์ 5์ด ํ์ swal์ด ์ฌ๋ผ์ง๊ฒ ํ๋ ค๊ณ timer: 5000
๋ฃ์๋๋ฐ ํ์ด๋จธ๊ฐ ๋๋๋ฉด ์ฌ์ฉ์๊ฐ ๋ฒํผ์ ํด๋ฆญํ์ง ์์๋ ๋ค๋ฅธ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค. ์ฌ์ฉ์๊ฐ swal์์ ๋ฒํผ์ ํด๋ฆญํ์ง ์์ ๊ฒฝ์ฐ ํ์ด์ง์ ๋จธ๋ฌผ๊ธฐ๋ฅผ ์ํฉ๋๋ค. ๋ด ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
Swal.fire({
html: "Your tip has been published.",
icon: 'warning',
showCancelButton: false,
confirmButtonText: "See tip",
timer: 5000,
customClass: {
container: 'custom-alert',
popup: 'published-tip',
actions: 'actions-btn'
},
}).then(function() {
window.location = "/" + data.username;
});
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํด๊ฒฐํ ์ ์์ด์ :)
window.location.href ๋ง ์ฌ์ฉํ์ญ์์ค. ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
});
๋์์ค์ ๊ณ ๋ง์