good.php alert -> script로 수정 채택완료
유성규
6년 전
조회 2,557
안녕하세요
good.php alert창을 바꾸고싶어서 SweetAlert2를 사용해서 바꿨습니다
</p>
<pre>
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>
';
}</pre>
<p>
이렇게 바꿨는데 알림창은 성공적으로 바꾼거같은데 확인을 누르면 이동한 페이지에 머물러있네요..
확인을 누르면 다시 원래화면으로 돌아오고싶은데 어디를 수정해야하는지 아시는분 계신가요..?
댓글을 작성하려면 로그인이 필요합니다.
답변 5개
6년 전
모두 친절한 답변 감사합니다!!
모두 채택드리고 싶은데 파아랑님이 소스까지 주셔서.. 너무 감동입니다
</p>
<pre>
<script>
Swal.fire({
text: "이미 추천하신 글 입니다."
}).then((ok) => {window.history.back()});
</script></pre>
<p>
답변 다 참고해서 이렇게 해결했네요 모두 다시한번 감사드립니다(__)
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
6년 전
참고 하시면 될듯합니다.
테스트는 해보지 않았습니다.
https://github.com/t4t5/sweetalert/issues/199">https://github.com/t4t5/sweetalert/issues/199
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인