ajax 异步调用把返回值赋给一个全局变量的用法,最主要的就是把async属性改为 false,
<script>
$(document).ready(function () {
<%
string dqsj = System.DateTime.Now.ToString("yyyy-MM-dd");
%>
seach();
});
var shuju = "";
var sj = "";
function se()
{
seach();
}
function seach() {
$(function () {
var strTady = $("#txtCxsj").val();
$.ajax({
async: false,
type: "POST",
url: "/qbjl/dqwdxx?strTady=" + strTady,
dataType: 'json',
success: function (data) {
shuju = data.rows;
sj = data.rows1;
}
});
$('#container').highcharts({
chart: {
zoomType: 'xy',
plotBackgroundImage: '/Yxjc/xml/themebg.png',
backgroundColor: '#e9ecef'
},
credits: {
enabled: false // 禁用版权信息
},
title: {
text: '大气温度数据展示'
},
xAxis: [{
categories: eval(sj)
}],
yAxis: [
{ // Secondary yAxis
gridLineWidth: 0,
title: {
text: '大气温度',
style: {
color: Highcharts.getOptions().colors[0]
}
},
labels: {
format: '{value} ℃',
style: {
color: Highcharts.getOptions().colors[0]
}
}
}
],
tooltip: {
shared: true
},
legend: {
layout: 'vertical',
align: 'center',
x: 350,
verticalAlign: 'top',
y: 15,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
series: [{
name: '大气温度',
data: eval(shuju)
}]
});
});
}
function IsTady() {
strTady = $("#txtCxsj").val();
var strsj = new Date();
var strrq = strsj.format("yyyy-MM-dd");
if (strTady != "") {
if (strTady < strrq) {
$("#NextBtn").show();
}
else {
$("#NextBtn").hide();
}
}
}
function BackDay() {
strTady = $("#txtCxsj").val();
if (strTady != "") {
var day = new Date(Date.parse(strTady.replace(/-/g, '/')));
day.setDate(day.getDate() - 1);
$("#txtCxsj").val(day.format("yyyy-MM-dd"));
seach();
}
else {
alert("查询日期不能为空");
}
}
function NextDay() {
strTady = $("#txtCxsj").val();
if (strTady != "") {
var day = new Date(Date.parse(strTady.replace(/-/g, '/')));
day.setDate(day.getDate() + 1);
$("#txtCxsj").val(day.format("yyyy-MM-dd"));
seach();
}
else {
alert("查询日期不能为空");
}
}
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds()
}
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return format;
}
</script>
<div class="box2" paneltitle="选择指针喷灌机" id="searchPanel">
<form action="" id="queryForm" method="post">
<input type="hidden" id="parentId" name="parentId" value="1" />
<table cellpadding="0" cellspacing="0" width="100%" class="table">
<tr>
<td class="ti_blue" width="70" style="text-align: right">查询日期:
</td>
<td width="150">
<input type="text" class="date" id="txtCxsj" datefmt="yyyy-MM-dd" name="gcjcxx.jcny" onpropertychange="IsTady()" value="<%=dqsj%>" />
</td>
<td class="ti_blue" width="220" style="text-align: left">
<button type="button" onclick="BackDay()"><span class="icon_find">上一天</span></button>
<button type="button" onclick="NextDay()" id="NextBtn" style="display: none"><span class="icon_find">下一天</span></button>
</td>
<td align="right" style="padding-right: 10px">
<button type="button" onclick="se()"><span class="icon_find">查询</span></button>
</td>
</tr>
</table>
</form>
</div>
<div style="border:solid 1px #bcf5f5">
<div id="container" style="min-width:700px;height:400px;"></div>
</div>
<div style="height:0px; width:100%;"></div>
ajax 异步调用把返回值赋给一个全局变量的用法,最主要的就是把async属性改为 false,的更多相关文章
- JavaScript 函数——语法,调用,返回值,局部变量,全局变量,未声明变量
JavaScript 函数是被设计为执行特定任务的代码块. JavaScript 函数会在某代码调用它时被执行. ㈠函数 ⑴什么是函数 函数是由事件驱动的或者当它被调用时执行的可重复使用的代码块. ⑵ ...
- jquery ajax异步调用
写程序的第一步都要知其然,至于知其所以然就要看个人的爱好了.下面说一下web开发中经常用的ajax. 这里是用的jquery框架实现的ajax异步调用.废话少说先上代码.(asp.net开发) var ...
- 获取的ajax方法return的返回值的问题解析
今天刚上班就偶遇关于获取Ajax方法return的返回值的问题,这里小记一下. 在使用jquery中,如果获取不到ajax返回值,原因有二: 一.ajax未使用同步 ajax未使用同步,导致数据未加载 ...
- shell调用函数返回值深入分析
编写shell脚本过程中,我们经常会自定义一些函数,并根据函数的返回值不同来执行相应的流程,那么我们如何来获取函数的返回值呢? 首先shell中调用函数有两种方式: 第一种:value=`functi ...
- jquery中ajax异步调用接口
之前写过一个原始的.无封装的页面,没有引入任何外部js,直接实例化Ajax的XmlRequest对象去异步调用接口,参见Ajax异步调用http接口后刷新页面,可对比一下. 现在我们用jquery包装 ...
- jquery的ajax异步请求接收返回json数据
http://www.jb51.net/article/51122.htm jquery的ajax异步请求接收返回json数据方法设置简单,一个是服务器处理程序是返回json数据,另一种就是ajax发 ...
- getchar()函数的返回值赋给char型,用if(ch=getchar() != EOF)测试,输入ctrl+z同样可以结束循环的分析
2013-07-18 21:35:58 getchar()函数的返回值赋给char型,用if(ch=getchar() != EOF)测试,输入ctrl+z同样可以结束循环的分析. char是字符型数 ...
- 获取JavaScript异步函数的返回值
今天研究一个小问题: 怎么拿到JavaScript异步函数的返回值? 1.错误尝试 当年未入行时,我的最初尝试: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <s ...
- Shell $?获取函数返回值或者上一个命令的退出状态
Shell $?获取函数返回值或者上一个命令的退出状态 来自:互联网 时间:2021-01-12 阅读:2 $? 是一个特殊变量,用来获取上一个命令的退出状态,或者上一个函数的返回值. 所谓退出状态, ...
随机推荐
- HDU 1698 Just a Hook
题意:初始1-n 值为1,有Q操作,每次可以把一段[l,r] 整段每个值变成 x,问最后的[1,n]总和. 线段树成段更新(基础题) #include<cstdio> #include&l ...
- SG函数 模板
int get_SG(int x) { ) return SG[x]; ]={}; ;i<=n;i++) ) v[get_SG(x-s[i])]=; int i; ;v[i];i++); SG[ ...
- 数列F[19] + F[13]的值
已知数列如下:F[1]=1, F[2]=1, F[3]=5,......,F[n] =F[n-1] + 2*F[n-2],求F[19] + F[13]? #include <stdio.h> ...
- [Java]Java简介
Java版本历史 1995年5月23日,Java语言诞生 1996年1月,第一个JDK1.0诞生 1996年4月,10个最主要的操作系统供应商申明将在其产品中嵌入JAVA技术 1996年9月,约8.3 ...
- iOS 端的 UI 聊天组件ChatKit及代码实现
ChatKit 是一个免费且开源的 UI 聊天组件,自带云服务器,自带推送,支持消息漫游,消息永久存储.底层聊天服务基于LeanCloud(原名 AVOS ) 的 IM 实时通信服务「LeanMess ...
- XAMPP启动mysql遇到的问题
Version: '10.1.9-MariaDB' socket: '' port: 3306 mariadb.org binary distribution2016-07-18 10:42:04 1 ...
- CSS引入方式的区别详解
在web前端开发中,CSS是一种用来表现HTML或XML等文件样式的语言.很多处于web前端初学阶段的朋友,很多人都不知道CSS引入方式存在三种方法,css引入方式分别为标签内联书写.页面头部书写.外 ...
- PHP四舍五入精确小数位及取整
php中取小数位的函数有sprintf,ceil,floor,round等等函数来实现四舍五入,下面我们就一起来看看具体的实例吧. 本篇文章将使用php对数字进行四舍五入保留N位小数,以及使用 ...
- JS原生回到顶部效果
// 回到顶部 onload = function () { var oBtnTop = document.getElementById('toTop'); var timer = null; oBt ...
- 加载JS