JQuery Get JSON data $.getjson method

Source: Internet
Author: User

  foreground:

 function selectproject () {var a = new Array; var r = window.showmodaldialog (' selproject.aspx ', A, "dialogwidth=1000px; dialogheight=600px;
            Resizable:yes ");
                if (typeof (R)!= ' undefined ') {var arr = r.split (";");
                $ ("#hidProjectInnerID"). Val (Arr[0]);
                $ ("#txtProjectNo"). Val (arr[1]); $.getjson ("..
                        /handler/getprojectinfor.ashx ", {key:" Paymentstatement ", Innerid: $ (" #hidProjectInnerID "). Val ()},
                            function (JSON) {$ ("#labFinalCustomer"). Text (json.finalclient);
                            $ ("#labOrderNo"). Text (Json.orderno);
                            var strdevicetr = ""; $.each (json.workinghours, function (I, item) {STRDEVICETR = "<tr><td><lab
                      Le name= "infor" > "+ item.description + </lable> </td>";          Strdevicetr + = "<td>   </td>";
                                Strdevicetr + + "<td><lable name=" infor ">" + item.hoursdays + "</lable></td>";
                                Strdevicetr + = "<td> 0.8</td>";
                                Strdevicetr + + "<td><lable name=" infor ">" + item.workinghour + "</lable></td>";
                                Strdevicetr + = "<td> 0.8</td>";
                                Strdevicetr + + "<td><lable name=" infor ">" + item.workinghour + "</lable></td>";
                                Strdevicetr + = "<td>  </td>";
                            STRDEVICETR = "</tr>";
                            });
                        $ ("#infor"). Append (STRDEVICETR);
            }); }
        }

Ashx

String Innerid = commonclass.request.getrequest&lt;string&gt; ("Innerid", "");
            String key = Commonclass.request.getrequest&lt;string&gt; ("Key", "");
            string result = "";
                if (key = = "Stockoutapp" &amp;&amp; innerid!= "") {result = Stockoutapp (Innerid); Context.
            Response.Write (Result); else if (key = = "Paymentstatement" &amp;&amp; innerid!= "") {result = PaymentS
                Tatement (Innerid); Context.
            Response.Write (Result);
                #region Billing Information public string paymentstatement (string _innerid) {try {
                String sql = @ "Select Innerid,pfinalclient,porderno from Se_projectmain where innerid= '" + _innerid + "'";
                DataTable dt = sqlshift.getdatatable (SQL); if (! CommonClass.DTRow.CheckDtIsEmpty (DT)) {StringBuilder json = new StrinGbuilder (); Json. Append ("Innerid": "" +dt. rows[0]["Innerid"].
                     ToString () + "" "); Json. Append ("," finalclient ":" "+ dt. rows[0]["Pfinalclient"].
                     ToString () + "" "); Json. Append ("," OrderNo ":" "+ dt. rows[0]["Porderno"].
                    ToString () + "" "); Json.
                    Append ("," workinghours ":" + getworkinghours (_innerid)); Return "{" + JSON. ToString ().
                Trim (', ') + "}"; else {return string.
                Empty; The catch (Exception ex) {Applog.write ("Item Gets an exception!") [Exception Info: + ex.]
                Message + "]", AppLog.LogMessageType.Info); return string.
            Empty;
                } public string Getworkinghours (string _innerid) {try { String sql = @ "Select Innerid, wdescription,wworkinghour,whours_days from Se_projectworkinghour where wprojectid= '" + _iNnerid + "'";
                DataTable dt = sqlshift.getdatatable (SQL); if (!
                    CommonClass.DTRow.CheckDtIsEmpty (DT)) {StringBuilder json = new StringBuilder (); for (int i = 0; i &lt; dt. Rows.Count; i++) {json.
                        Append ("{"); Json. Append ("Innerid": "" + dt. rows[0]["Innerid"].
                        ToString () + "" "); Json. Append ("," description ":" "+ dt. rows[0]["Wdescription"].
                        ToString () + "" "); Json. Append ("," Workinghour ":" "+ dt. rows[0]["Wworkinghour"].
                        ToString () + "" "); Json. Append ("," Hoursdays ":" "+ dt. rows[0]["Whours_days"].
                        ToString () + "" "); Json.
                    Append ("},"); Return "[" + JSON. ToString ().
                Trim (', ') + "]"; else {return string.
                Empty;
}
            }            catch (Exception ex) {Applog.write ("Item gets exception!") [Exception Info: + ex.]
                Message + "]", AppLog.LogMessageType.Info); return string.
            Empty;  }} #endregion
&nbsp; &nbsp;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.