Adding SweetAlert to app


#1

Hi,

I used SweetAlert with some of my older apps. I added it to my project by downloading it and dragging sweetalert.min.js and sweetalert.css into my project.

I am looking at using the updated version, SweetAlert2, but i can’t see these files in the downloaded folder. There a a number of javascript and SCSS files in the folder but i have no idea how to use these.

Any guidance is greatly appreciated.


#2

You should be able to drag and drop js and css files into AppStudio’s File Explorer window.


#3

I was able to drag in the SCSS file but for some reason, it won’t let me drag in any javascript file.
I am running the latest version.


#4

The easiest way to use SweetAlert in AppStudio is to paste this into ‘extraheaders’ in Project Properties:

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

Then, in your app, do this:

swal("Here's the title!", "...and here's the text!");

To get this:


#5

You can also drag and drop SweetAlert,min,js into your project’s Project Explorer. It will then look like this:

30%20AM

The file will be copied into your project’s ‘includes’ folder.

Calling it is the same.


#6

Thank you. I was able to get it to work.