Javascript Tutorials – Error Capture (Try-Catch)

JavaScript-Tutorial

We continue our JavaScript classes with a try-catch structure, when the form information entered by the user is not in the desired format or type, we can catch the error and generate the appropriate warning messages or error messages with throw or notify the user from the system.
In our first application, the function named message is not defined and the error message is read from the system.


 

Check live version; http://jsfiddle.net/
In our second application entering a number in the text box, the number entered must be between 5-10 if entered outside this range, we will generate an error and give it to the user as a message..

 

check live version; http://jsfiddle.net/
jQuery(document).ready(function($) { $.post('https://opensourceprojects.org/wp-admin/admin-ajax.php', {action: 'wpt_view_count', id: '1061'}); });
80%
Awesome
  • Design

Leave A Reply

Your email address will not be published.