Recently, users are placing more and more emphasis on the interaction of UI interfaces. Gradually, JavaScript (hereinafter referred to as JS), which was only a supporting role to a little dragon, has become the protagonist, occupying a large part of the use.
For example, the recently popular ASP.NET MVC can directly include JQuery.
After using MVC for a while, Xiaolong even felt that the Controller in MVC was controlled by JS at all. How to make the UI work independent and hand it over to the artist also felt like a big question.
It seems that the artists in the back can only draw and pull images. They must know JS, Flash and other front-end control languages to be popular.
Here, a little dragon will introduce how to use JavaScript to dynamically call functions. At this time, we need to introduce the premise first, so that readers can understand where the following technology can be applied.
Generally, dynamic calls are used. Basically, the back-end dynamically generates JS code, which is called by the front-end JS framework.
The purpose of this is to dynamically set the fields, styles, data, etc. of the UI. Another possibility is to retain the extensibility of the JS framework so that subsequent developers can You can write additional code to expand the functionality of the original JS framework based on the characteristics of each program.
Let’s introduce it below. As far as Xiaolong knows, there should be the following two ways of dynamic calling function