Summer Sale! All accounts are 50% off this week.

MuhammadMaaz's avatar

Sweetalert is not working.

i'm trying to delete my products through sweetalert,but it shows the error that swal is not defined,tbh i don't have much idea about sweetalert.please guide me about it.

0 likes
7 replies
Tray2's avatar

Show us what you have done so far.

MuhammadMaaz's avatar

this is my js validation

$(".deleteRecord").click(function(){
		//alert("test");
		var id= $(this).attr('rel');
		//alert(id);
		var deletefunction= $(this).attr('rel1');
		//alert(deletefunction);
		Swal.fire({
			title: "Are you sure?",
			text: "You will not be able to recover this record again!",
			type:"warning",
			showCancelButton: true,
			confirmButtonClass: "btn-danger",
			confirmButtonText: "Yes, delete it!"
		},
		function(){
			window.location.href="/admin/"+deleteFunction+"/"+id;
		});
MuhammadMaaz's avatar

i included it as,

https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.css
https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js
MuhammadMaaz's avatar

do i need to define anything about sweetalert in my header file?

MuhammadMaaz's avatar

thanks i have done it.i was just missing proper format,pardon me.thanks for your help.

Please or to participate in this conversation.