1
I’m trying to use sweetalert
to give an alert of "Submitted".
if($rstSql["cod_erro"] == 0)
{
echo '<script> swal("Good job!", "You clicked the button!", "success"); <script>';
}
else
{
echo '<script>alert("message2");</script>';
}
Apparently the standard alert works, while the SWAL doesn’t. I tested on another page and called normally, libraries are being called on:
<script src="swap/sweet-alert.js"></script>
<link rel="stylesheet" type="text/css" href="swap/sweet-alert.css">
When I debug Chrome I have the following message:
Uncaught Typeerror: Cannot read Property "prototype'of Undefined>
Which @Felipe line is this error (in the console speaks the line). Could post an example of the problem in jsfiddle?
– Guilherme Nascimento
In the code, the error appears only in the line I call swal, which I have already posted above. However, I get error in some lines of the Sweetalert library: Uncaught Typeerror? Cannot call method 'appendchild' of null. The funny thing is that I use the same library in a clean file and this one works.
– Felipe
You put
<script src="swap/sweet-alert.js"></script>
inside<head>
andif($rstSql["cod_erro"] == 0)
{
 echo '<script> swal("Good job!", "You clicked the button!", "success"); <script>';
}
else
{
 echo '<script>alert("message2");</script>'; 
}
inside<body>
???– Guilherme Nascimento