jquery ajax 跨域

$(document).ready(function() {
                var url = "http://220.176.196.172:8080/srsweb/AllSearch?searchType=ggqsyIndex&jsoncallback=?"
                $.getJSON(url,"",
                function(json) {
                    alert(json);
                    alert(json[0].a);
                    alert(json[0].b);
                    alert(json[0].c);
                    //返回格式: ?(json_data) 
                    /*返回数据: ?([{"www_url":"www.aiisen.com","www_name":"www_name",
                     "items":[{"p_name":"安徽省","p_index":340000},{"p_name":"北京市","p_index":110000}]}]) */
                    //调用实例:alert(json[0].www_url); 
                });
                



            });
response.setContentType("text/html;charset=utf-8");
                PrintWriter out = response.getWriter();
                
                EcmsContentTablesDao ecmsContentTablesDao = new EcmsContentTablesDao();
                String type = request.getParameter("type");
                String nodeParentDept = "_647";
                String nodeParentDept1 = "_3";
                int count = ecmsContentTablesDao.getMaxSearcheCount1Ggqsy(" select count(nodeid) as ct from ecms_nodes where parentdept = '"+nodeParentDept+"' or parentdept like '"+nodeParentDept+"!_%' escape '!' or parentdept = '"+nodeParentDept1+"' or parentdept like '"+nodeParentDept1+"!_%' escape '!' ");
                int count1= ecmsContentTablesDao.getMaxSearcheCount1Ggqsy("select count(*) as ct from ecms_content_info ");
                
                
                
                
                int count2= ecmsContentTablesDao.getMaxSearcheCount1Ggqsy("select count(*) as ct from ecms_content_info where Status='0'");
                    
                
                System.out.println("dddddddddddddd:"+"[{a:'"+count+"',b:'"+count1+"',c:'"+count2+"'}]");
                
                
                String jsoncallback = request.getParameter("jsoncallback");
                System.out.println("jsoncallback:"+jsoncallback);
                
//                out.write("[{a:'"+count+"',b:'"+count1+"',c:'"+count2+"'}]");
                out.write(jsoncallback+"([{a:'"+count+"',b:'"+count1+"',c:'"+count2+"'}])");
                out.flush();
                out.close();

相关推荐