Connecting all function calls to JavaScript?

My intuitive answer to this question will be: "It is so stupid that I can not continue this conversation." But:

Is there a way to include all javascript function calls in my module? I would like to find a convenient way to display the messages "loading blah ...", "done ..." when making AJAX calls without having to explicitly place the notification method call in each AJAX method.

Also, is there a convenient way to set up a global exception handler in javascript?

It is absolutely possible, of course, to eliminate the need for any of these things by doing the correct exception handling in each applicable method, but it would be nice to have a global “Oops!”. a method to happily catch everything that managed to slip due to a programmer's error (i.e. me).

Work in C # / ASP.NET if that matters, or if there is a server-side gadget that can make this easier.

+3
source share
4 answers

window.onerror will catch all errors. The way Firebug and others work.

As for "every ajax method," you should have only one ajax reuse method and it will be responsible for updating your status message.

+1

ajax, , open send, .

jquery - , , .

.

+1

function show_props (obj, obj_name) {var result = "for (var in obj) result = obj_name". "" = "obj [i]" \n" return result; } http://www.memestreams.net/users/acidus/blogid10323750/

0

jQuery AOP. .

0

Source: https://habr.com/ru/post/1718342/


All Articles