jquery跨js文件调用函数示例

 1 var common_func; (function() {
 2     common_func = {
 3         load_hot_data: function(AreaCode) {
 4             var hot_html = "";
 5             $.get("http://localhost:32684/Affairs/GetHotAffairsListKunMing?areaCode=" + AreaCode + "&pageSize=10",
 6             function(data) {
 7                 if (data.Result) {
 8                     $.each(data.Data,
 9                     function(index, obj) {
10                         hot_html += '<li>' + '<a href="javascript:;" title="' + obj.AffairName + '">' + '<i class="_circle"  style="transform: scale(1); background: rgb(153, 153, 153);" >' + '</i>' + '<span>' + obj.AffairName + '</span>' + '</a>' + '</li>'
11                     })
12                 } else {
13                     hot_html = '<li>' + '<a href="javascript:;" title="">' + '<i class="_circle"></i>' + '<span>暂未找到热点事项信息</span>' + "</a>" + '</li>'
14                 }
15                 $("#hot_matter_more").prevAll().empty();
16                 $("#hot_matter_more").before(hot_html);
17 
18             })
19         },
20 
21         load_dept_data: function(AreaCode) {
22             var deptData = [];
23             $.get("http://localhost:32684/Dictionary/getAffairDeptTypeByArea?IS_LEGALPERSON=-1&AreaCode=" + AreaCode + "",
24             function(data) {
25                 if (data.Result) {
26                     $.each(data.Data,
27                     function(index, obj) {
28                         var item = {
29                             link: "/Affairs/LegalPerson?groupNum=1&typeCode=" + obj.Code + "&typeName=" + obj.Name,
30                             target: "_blank",
31                             title: obj.Name,
32                             id: obj.Code
33                         }
34                         deptData.push(item);
35                     })
36                 } else {
37                     deptData.push({
38                         link: "#",
39                         target: "_blank",
40                         title: "该区划下未找到部门信息"
41                     });
42                 }
43                 $(".theme_dept_hot .theme_dept_info .box_dept_info ._dept_info").pageSilder("DeptPageSilder", {
44                     pageSize: 30,
45                     data: deptData
46                 });
47             })
48         }
49     }
50 })()

猜你喜欢

转载自www.cnblogs.com/netlws/p/11708963.html