js从后台无法取值问题
2014-01-24 20:34
295 查看
前台代码
后台代码
不能直接使用json_addusers在查询数据库后取值,要用json1来做变量,暂时没搞清楚为什么
<script type="text/javascript"> $(function () { var chart; $(document).ready(function () { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'line', marginRight: 130, marginBottom: 25 }, title: { text: '新增用户趋势图', x: -20 //center }, subtitle: { text: 'Source: tourol.cn', x: -20 }, xAxis: { categories: <%= json_dates %> }, yAxis: { title: { text: '人数' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function () { return '<b>' + this.x + '</b><br/>' + '新增加人数 ' + this.y; } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -10, y: 100, borderWidth: 0 }, series: [{ name: '新增人数', data: <%= json_addusers %> }] }); }); }); $(function () { $(".index_tap_item>a").click(function () { $(".nav-stacked>li").each(function () { $(this).removeClass('active'); $("#liuserstatics").addClass('active'); }); $(".tab-pane").each(function () { $(this).removeClass('active'); $("#userstatics").addClass('active'); }); }); }); </script>
后台代码
public partial class statics_Default : System.Web.UI.Page { public string json_addusers = string.Empty; public string json_dates = string.Empty; protected void Page_Load(object sender, EventArgs e) { getData(); } private void getData() { System.Data.DataTable datas = DBUtility.DBExecuteUtil.querySqlTable( " SELECT COUNT(*) addusers,CONVERT(varchar(100), [RegistDate], 23) dates FROM [FenxCloudZj].[dbo].[tourol_B2CUser] group by CONVERT(varchar(100), [RegistDate], 23)"); string json1 = "["; string json2 = "["; for (int i = (datas.Rows.Count > 10 ? 10 : datas.Rows.Count); i > 0; i--) { json1 += datas.Rows[i]["addusers"] + ","; json2 += "\"" + datas.Rows[i]["dates"] + "\","; } json1 = json1.TrimEnd(','); json1 += "]"; json_addusers = json1; json2 = json2.TrimEnd(','); json2 += "]"; json_dates = json2; } }
不能直接使用json_addusers在查询数据库后取值,要用json1来做变量,暂时没搞清楚为什么
相关文章推荐
- java使用axios.js的post请求后台时无法接收到入参的问题
- js给textbox赋值,后台取值的问题
- 整了一天的问题 JS 赋值 CS后台取值
- (小技巧)解决JS修改服务器控件值在后台无法获取修改后的值的问题
- 利用JavaScript动态增加的文本输入框在后台无法取值问题的解决
- 解决用JS修改服务器端控件值后在后台无法获取修改后值的问题
- 解决用JS修改服务器端控件值后在后台无法获取修改后值的问题
- js给textbox赋值,后台取值的问题
- java使用axios.js的post请求后台时无法接收到参数的问题
- 关于TextBox属性ReadOnly=“true”时,后台无法获取js重新对TextBox的赋值问题
- TextBox ReadOnly / Enabled 时,后台无法取值问题
- textbox 设置enabled=false 或是readonly=true 后,在后台无法取值的问题
- 解决java使用axios.js的post请求后台时无法接收到入参的问题
- Javascript动态添加文本输入框在后台无法取值问题的解决
- js前端通过document.getElementById("").innerHTML赋值无法传到后台问题解决
- 关于UseSubmitBehavior和OnClientClick同时使用,导致无法触发后台事件的问题
- mvc ajax访问后台时session过期无法跳转到Login页面问题解决
- AngularJs ng-options 无法设置value的问题
- 解决:maven项目无法引入js,css的问题
- js解析php返回的json数据无法获取length的问题分析