Remove multiple elements from an array in Javascript/jQuery

Remove multiple elements from an array in Javascript/jQuery

In this post, we will learn how to Remove multiple elements from an array using Javascript or jQuery give with an example. We can simply remove elements from an array using javascript. Below in the post, we have tried different methods to do the same. Let's suppose we have an array in which and we want to remove some particular element from the array without refreshing the page. In that...
How to access PHP variables in JavaScript or jQuery

How to access PHP variables in JavaScript or jQuery

Sometimes we need to access the PHP variables in javascript or jquery for the use in the application. In this article, let’s see how to pass data and variables from PHP to JavaScript. If you have a simple string value in PHP and you want to access that value in javascript or jquery then you have two options to do so. First, we can pass the data through cookies. In...
How to Remove Empty Object From JSON in JavaScript

How to Remove Empty Object From JSON in JavaScript

In this post, we have removed empty objects in JSON using Javascript. It is a very simple code snippet to remove all empty objects in JSON. <DOCTYPE html> <html> <head> <title>How to remove empty object from json in javascript</title> </head> <body> <script type="text/javascript"> const objectData= { b:'object', c: '', d: null, f: {v: 2, x: '', y: null, m: {a:'xyz'}} }; const removeEmptyOrNullObject = (obj) => { Object.keys(obj).forEach(k => (obj[k]...
How to upload a file with JavaScript and PHP

How to upload a file with JavaScript and PHP

File uploading option on a website is common. But to make it work from scratch seems a very difficult task and sometimes we have to waste lots of time to figure out if things do not work properly. In this tutorial, we will upload the file using javascript and PHP with a simple function. Javascript will be used to initiate the function and PHP to upload the file on the...
How to Remove HTML Tags from String using JavaScript

How to Remove HTML Tags from String using JavaScript

Sometimes we get data from the server which contains HTML elements such as div span or internal CSS. We can either remove or parse those tags using backend language or we can achieve the same with javascript replace() function. Using Regex in javascript we can remove any HLMT tag from the string. following is the code to remove the HMLT tags from string. var str = "<div>Hello, <h2>atcodex</h2></div>"; var textData...
How to use Google map autocomplete location search API with example

How to use Google map autocomplete location search API with example

What is an API API Stands for Application Programming Interface, which allows us to connect two or more applications to each other. Whenever you use an application like Whatsapp, Instagram, or any other App on your phone, your phone is using an API to communicate with the server to show you data. When you use any app on your mobile, the app sends the data to the server. Then the...