The requirement is that the data can no longer be loaded when the page is accessed, and can only be loaded when one of the buttons is clicked. Concrete effects such as the bottom diagram.
1. Front Page
1class="title"Id="001"Name="001"onclick="GetData (1)">2Overview <spanclass="Title_icon">3<divclass="mc_list"Id="div001"style="Display:none">4 5</div>
2. Ajax Code
1 GetData (n) {2 $.ajax ({3Type"Get",4Url:"getdatahander.ashx?para="+ N +"&jbid="+Jbid,5DataType:"JSON",6 success:function (data) {7 $.each (data, function (IDX, item) {8$("#div00"+N). empty ();9$("#div00"+ N). Append ("<span style= ' font-family: blackbody; font-size:14pt; ' >"+ Item. Disarticleinfo_title +"</span></br>"+ Item. Disarticleinfo_info +"<br/>");Ten }); One } A }); -}
3. ashx page
1 Public voidProcessRequest (HttpContext context)2 {3Context. Response.ContentType ="Text/plain";4 stringPara = context. request["para"]. ToString ();5DataTable dt =NewDataTable ();6DataTable DT1 =NewDataTable ();7DataTable DT2 =NewDataTable ();8DataTable DT3 =NewDataTable ();9DataTable DT4 =NewDataTable ();Ten stringstr =string. Empty; One if(Para = ="1") A { -DT = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and (disarticleinfo_articletypeid=24 or disarticleinfo_articletypeid=1)","disarticleinfo_id desc"). tables[0]; - } the if(Para = ="2") - { -DT = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=16","disarticleinfo_id desc"). tables[0]; - } + if(Para = ="3") - { +DT = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=2","disarticleinfo_id desc"). tables[0]; A } at if(Para = ="4") - { -DT = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=18","disarticleinfo_id desc"). tables[0]; -DT1 = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=19","disarticleinfo_id desc"). tables[0]; -DT2 = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=21","disarticleinfo_id desc"). tables[0]; -DT3 = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=22","disarticleinfo_id desc"). tables[0]; in } - if(Para = ="5") to { +DT = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=8","disarticleinfo_id desc"). tables[0]; -DT4 = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=9","disarticleinfo_id desc"). tables[0]; the } * if(Para = ="6") $ {Panax NotoginsengDT = Disbll. GetList (1,"disarticleinfo_diseaseid="+ context. request["Jbid"] +"and disarticleinfo_articletypeid=4","disarticleinfo_id desc"). tables[0]; - } the if(dt. Rows.Count >0) + { ASTR =jsonconvert.serializeobject (DT,NewDatatableconverter ()); the if(DT1. Rows.Count >0|| DT2. Rows.Count >0|| DT3. Rows.Count >0) + { - dt. Merge (DT1); $ DT2. Merge (DT3); $ dt. Merge (DT2); -str = jsonconvert.serializeobject (DT,NewDatatableconverter ()); - } the if(DT4. Rows.count>0) - {Wuyi dt. Merge (DT4); thestr = jsonconvert.serializeobject (DT,NewDatatableconverter ()); - } Wu } - context. Response.Write (str); AboutContext. Response.End ();
4. Page effect
Use of Ajax loaded data