设为首页 加入收藏

TOP

JQuery 获取json数据[$.getJSON方法](一)
2014-11-24 07:46:12 来源: 作者: 【 】 浏览:0
Tags:JQuery 获取 json 数据 .getJSON 方法
";
strDeviceTr += "";
strDeviceTr += " ";
strDeviceTr += "";
strDeviceTr += "";
strDeviceTr += "";
strDeviceTr += "";
strDeviceTr += "";
strDeviceTr += "";
});
$("#infor").append(strDeviceTr);
});
}
}


ashx:


string innerid = CommonClass.Request.GetRequest("InnerID", "");
string key = CommonClass.Request.GetRequest("key", "");
string result = "";
if (key == "StockOutApp" && innerid != "")
{
result = StockOutApp(innerid);
context.Response.Write(result);
}
else if (key == "PaymentStatement" && innerid != "")
{
result = PaymentStatement(innerid);
context.Response.Write(result);
}
#region 结算单信息


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;
}
}
catch (Exception ex)
{
AppLog.Write("项目获取异常![异常信息:" + 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 < dt.Rows.Count; i++)
{
json.Append("{");
json.Append("\"innerid\":\"" + dt.Rows[0]["InnerID"].ToString() + "\"");
json.Append(

JQuery 获取json数据[$.getJSON方法]


前台:


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 += "

" + item.description + "   " + item.hoursdays + " 0.8 " + item.workinghour + " 0.8 " + item.workinghour + "  
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Struts2轻松实现多文件上传(自定.. 下一篇Android中C++调用Java实现

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·PostgreSQL 索引 - (2025-12-25 22:20:43)
·MySQL Node.js 连接 (2025-12-25 22:20:41)
·SQL 撤销索引、表以 (2025-12-25 22:20:38)
·Linux系统简介 (2025-12-25 21:55:25)
·Linux安装MySQL过程 (2025-12-25 21:55:22)