good.php alert -> script로 수정 채택완료
안녕하세요
good.php alert창을 바꾸고싶어서 SweetAlert2를 사용해서 바꿨습니다
if ($row['bg_flag'])
{
if ($row['bg_flag'] == 'good')
$status = '추천';
else
$status = '비추천';
//alert("이미 $status 하신 글 입니다.");
echo'
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="'.G5_PLUGIN_URL.'/sweetalert2/sweetalert2.min.css" />
<script type="text/javascript" src="'.G5_PLUGIN_URL.'/sweetalert2/sweetalert2.min.js"></script>
<script>
Swal.fire({
text: "이미 추천하신 글 입니다."
})
</script>
</body>
</html>
';
}
이렇게 바꿨는데 알림창은 성공적으로 바꾼거같은데 확인을 누르면 이동한 페이지에 머물러있네요..
확인을 누르면 다시 원래화면으로 돌아오고싶은데 어디를 수정해야하는지 아시는분 계신가요..?
답변 5개
echo '<script>
setTimeout(function() {
swal({
title: "Wow!",
text: "Message!",
type: "success"
}, function() {
window.location = "redirectURL";
});
}, 1000);
</script>';
댓글을 작성하려면 로그인이 필요합니다.
모두 친절한 답변 감사합니다!!
모두 채택드리고 싶은데 파아랑님이 소스까지 주셔서.. 너무 감동입니다
<script>
Swal.fire({
text: "이미 추천하신 글 입니다."
}).then((ok) => {window.history.back()});
</script>
답변 다 참고해서 이렇게 해결했네요 모두 다시한번 감사드립니다(__)
댓글을 작성하려면 로그인이 필요합니다.
파이랑님 소스도 되고 따로 swal 작업후 하는 이벤트가 있는걸로 기억합니다. 해당 플러그인을 살펴보시면 됩니다.
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인