Hey there! I'm curious, do you know of any sleek alternatives to the standard JavaScript alert function? I'm looking for something a bit more innovative that allows me to personalize the appearance of

I attempted to create a customized alert box using HTML, CSS, and JavaScript. However, I am facing the issue of how to call it within the echo function of PHP.

if (($con -> query($query) === TRUE) &&
($con -> query($query1) === TRUE) &&
($con -> query($query2) === TRUE) &&
($con -> query($query3) === TRUE))
{
   echo "<script>alert('Employee Successfully Added')</script>";
}

If all queries are successful, the custom alert box will display.

Answer №1

Make use of sweetalert for better user experience

<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
Swal.fire({
  position: 'top-end',
  icon: 'success',
  title: 'Your changes have been successfully saved',
  showConfirmButton: false,
  timer: 1500
})

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Run JavaScript on every website when the page loads

After loading all or specific pages in the browser, I am looking to run JavaScript code (predefined code). Are there any browsers and plugins/components that allow me to achieve this? The manual method involves opening the console (e.g. firebug) and execu ...

Showing loading spinner when clicked

I created a spinning animation in CSS, but now I want to hide it and only display it when a button is clicked. I've tried to achieve this using the following code, but the spinner doesn't appear when I click the submit button. To hide the spinne ...

Automatically scrolling through a nested list in ReactJs

I have a chat list integrated into my web application. The entire webpage is scrollable, as shown in the image at the bottom. I would like the messages list to automatically scroll to the bottom whenever a new message arrives. To achieve this, I created a ...

Adjust counter to allocate points based on team in Vue.js

Currently, I am tackling a Vue.js 3 school assignment that involves a dynamic number of teams competing in a football championship. The team data is stored in a JSON format and accessed via an API. The task at hand requires selecting two teams - one repres ...

Having difficulties sending the form information

Being new to AngularJS, I created a simple popup where users can add tasks and submit them. There is an "Add task" button that dynamically adds fields for users to enter details into. Below is the HTML markup for my popup: <div class="modal-heade ...

What other methods can be used to initiate an Ajax request?

I'm curious about the most efficient approach to making an AJAX call. My current code works perfectly fine: $.ajax({ url: "/rest/computer", type: "GET", dataType: "json", data: { assessmentId: "123", classroomId: " ...

Crosswalk code unable to detect electronic devices

The implementation of a rails application involves the following code snippet: <div id="sourceSelectPanel" style="display:none"> <label for="sourceSelect"& gt;Change video source:& lt;/label> <select id=" ...

Understanding how to extract inner text and splitting it can be a challenging task for developers when working with Javascript

Exploring the following basic html code: <div id="content"> This is a test </div> I am puzzled as to why this works: $(function(){ text = 'this is a text'; word = text.split(' '); alert(word[1]) }) while this does not: ...

Is there a way to retrieve all indices of an array?

Is there a way to retrieve all the index positions of the elements in an array? [ { "name":"aloha", "age":"18" }, { "name":"hello word" }, { "name":"John Doe", "age":"28" } ] The expected output sho ...

Assign individual heights to multiple iFrames according to their content's height

Dealing with multiple iframes on a single page. Each iframe is sourced from my domain. The goal is to automatically calculate and set the height of each iframe on the page. The current code sets all iframe heights to match that of a specific iframe: fun ...

Using mapStateToProps to retrieve data

I have a component that requires data from my Redux store. However, the data is being passed in a different way than expected. I am unsure how to use mapStateToProps in this scenario to retrieve the necessary information. Here is the component where I nee ...

Using the Firefox API to determine if a tab is currently active

I remember hearing about a feature that was introduced in some recent versions of Firefox allowing developers to check if a tab is active or not using JavaScript. However, I am having trouble finding more information about it online. Can you share the li ...

Positioning Firefox absolutely within a table-cell element is possible

Interestingly, it's not Internet Explorer causing me trouble this time, but Firefox. Here is the Fiddle link for reference: http://jsfiddle.net/EwUnt/ The purpose of this table is to highlight both the row and column of the cell where the cursor is ...

Exploring the navigation options within React Native's DrawerLayoutAndroid component

My goal is to seamlessly navigate between different views using the Drawer layout. It would be ideal if I could achieve this directly in the navBar without having to create a separate toolbar for each view https://i.sstatic.net/joOeB.png Currently, clicki ...

Ways to extract the text input from a playwright box

I have a text input field on my webpage with the ID "email30" and I am attempting to retrieve its value using Playwright. let email_handle = await page.$("#email30"); let value = await email_handle.getAttribute("value"); Unfortunately, it returns an e ...

Exploring the Live Search Functionality on an HTML Webpage

I am attempting to create a live search on dive elements within an HTML document. var val; $(document).ready(function() { $('#search').keyup(function() { var value = document.getElementById('search').value; val = $.trim(val ...

Retrieving data from a JSON file depending on the selection made by the user in a dropdown menu

In my project, I have a JSON file named countries.json that contains country and regional information. Users are required to select a country using a Python-generated dropdown list from this file. However, due to the backend nature of Python, I am unable t ...

Ways to ensure all images have been successfully uploaded to Firebase before executing a function

Here's a function I've created that takes image URIs from the state, uploads them to Firebase Storage, and then updates the state with the download URLs: uploadImages = async (userID) => { // Loop through each image for (var index = 0 ...

Issue with displaying entire object using Jest and console.dir

I'm having trouble displaying an error in my Jest test because it's not showing all the levels as expected. import util from 'util' describe('Module', () => { it('should display all levels WITHOUT util', () =& ...

Issues encountered when using v-model with JavaScript functions

Being a newcomer to Vue JS, I have been immersing myself in the official documentation to learn more about it. My current project is a straightforward task management web application. However, I seem to be encountering issues with the v-model directive a ...