Home >Web Front-end >JS Tutorial >Simple method to use jQuery plug-in Tmpl_jquery

Simple method to use jQuery plug-in Tmpl_jquery

WBOY
WBOYOriginal
2016-05-16 16:01:581132browse

1.Introduce script

2. Write templates

2.1 Assume that there is a data sent from the background in json format

Copy code The code is as follows:
[{"tId":1,"tName":"Zhang San ","tAge":14,"tClass":1,"TeachClass":{"cId":1,"cName":"Class 1"}},
Copy code The code is as follows:
{"tId":2,"tName":"李思","tAge":25,"tClass":1," TeachClass":{"cId":1,"cName":"Class 1"}},
Copy code The code is as follows:
{"tId":4,"tName":"Zhao Liu","tAge":16,"tClass":2,"TeachClass":{"cId":2,"cName":" Class 2"}}]

2.2 The content you want to display at this time is as follows

Then set the template according to the content you want to display:

[Similar to the repeater control in aspx]

[Note: Remember to set the id]

3. Fill in the template

According to the above assumption, the background returns a string in json format, then request it through ajax and fill in the template

4. Saw the effect page

The above is the entire content of this article, I hope you all like it.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn