How to fire AJAX Request on Regular Interval

There are many cases when require to update certain parts of the web page on a regular basis.

For example – showing live cricket or football score, display the latest news feeds, etc.

There are two ways to send AJAX request at a specified time –

  • By setInterval() and
  • By setTimeout() JavaScript functions.

Both do the same work but they are reliable for certain cases, which I discuss in this tutorial.

How to fire AJAX Request on Regular Interval

Read more

Create custom alert with sweetAlert jQuery plugin

Alert is one of the most used functions in JavaScript. By this, you can interact with users by showing information on the screen.

For example, use it in form validation for showing the warning on invalid input or using it to display the alert message when form successfully submitted, etc.

But, the problem is it does not look good on the screen.

There are many free jQuery plugins that you can use to show the user-friendly message box.

In this tutorial, I am using sweetAlert jQuery plugin to show a custom message box on the screen and use it as an alternative to the default alert box.

It looks much better than the default alert and it is responsive.

Create custom alert with sweetAlert jQuery plugin

Read more

Add validation to the form with jQuery Validation Plugin

You generally display an error message while validating the form by using the alert or place message on <div> or <span> elements and show or hide them.

If you have a form that has many elements and you need to add Client-side Validation.

You are using the container to show the error messages in this case you need to create several container elements. It is a time-consuming process.

For making your validation process simpler there are many free jQuery plugins.

In this tutorial, I will explain you about Validation jQuery Plugin, using that you can define validation faster and systematic way.

It has the built-in method which you can use for validation and you can change the text of the default error message.

You can also create your own method if you do not find any built-in method according to your requirement.

Add validation to the form with jQuery Validation Plugin

Read more

Disable Right click and cut copy paste with jQuery

With jQuery and javascript, it is possible to control the flow of the right click, cut, copy, and paste within the whole web page or from a particular section.

This type of functionality is mainly found in the Test based web application where a student is not allowed to copy and paste content on the page.

Or displaying the custom context menu on right-click.

Disable Right click and cut copy paste with jQuery

Read more