Home >Backend Development >PHP Tutorial >jQuery uses zy_tmpl to generate drop-down menu after getting json_PHP tutorial
This article mainly introduces the example of using jQuery to get json and then using zy_tmpl to generate a drop-down menu during my development process. Although it is the first I will write about the development of AppCan at once, friends in need can refer to it.
This is my first time writing an article about AppCan development. Someone has written about the interaction between jQuery or native Ajax and json. Then I will briefly write about an example of using jQuery to obtain json and then using zy_tmpl to generate a drop-down menu during my development process.
The part where the PHP server generates json is not so much, just input an array $res, and then
The code is as follows:
In the AppCan template, first add a drop-down menu. My menu is:
?
3 4
5
6
9 10 11 12 |
|
1 2 3 4 5 6 7 | function getlq(){ $.getJSON('http://localhost/json.php?jsoncallback=?', function(data) { var tmpl=''; $("#lc").html(""); $("#lc").append(zy_tmpl(tmpl,data,zy_tmpl_count(data))); }) } |