8.ajax查询数据
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="../../../CSS/bootstrap/bootstrap.min.css" rel="stylesheet" />
<!--如果有修改该配置文件,请修改"?"号后面的参数-->
<script src="../../../Scripts/config.js?v=1.1"></script>
<script src="../../../Scripts/Base64.js"></script>
<script src="../../../Scripts/jquery/jquery-1.10.2.min.js"></script>
<script src="../../../Scripts/bootstrap.min.js"></script>
<script src="../../../Scripts/jquery.form.js"></script>
<script type="text/javascript">
var url = "http://localhost";
$(function () {
//导出数据
$("#BtnExport").click(exportData);
$("#BtnCaseSuit").click(CaseSuit);
$("#BtnCaseSearch").click(CaseSearch);
$("#BtnWorkItemDetails").click(getWorkItemDetails);
$("#BtnUpdateTestCaseResult").click(updateTestCaseResult);
$("#BtnGetDetailsOfTestCase").click(GetDetailsOfTestCase);
}); //修改执行用例的测试结果
function updateTestCaseResult() {
var json = {
CollectionName: '项间需求2',
ProjectName: '项间需求项目2',
TestRunid: '',
TestCaseResultInfo: {
ComputerName: "",
FailureType: "",
FailureTypeId: "",
Priority: "",
State: "",
TestCaseRevision: "",
Comment: "此处为注释",
DateCompleted: "2016-5-9",
DateStarted: "2015-5-5",
ErrorMessage: "错误信息",
Outcome: ""
}
};
$.ajax({
type: "post",
url: "http://localhost:8080/TfsWebApi/api/TestDoCase/UpdateTestResult",
data: JSON.stringify(json),
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
alert(data);
}
});
}
//查询工作项详情
function getWorkItemDetails() {
$.ajax({
type: "post",
url: "http://localhost/TfsWebApi/api/WorkItem/GetDetailsOfWorkItem",
data: "{'collectionName':'项间需求2','projectName':'项间需求项目2',id:'218'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
alert(data);
}
});
} //计划
function exportData() {
$.ajax({
type: "post",
url: "http://localhost/TfsWebApi/api/TestPlan/GetTestPlan",
data: "{'collectionName':'WX201512','projectName':'WX20151207'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var value = "";
$(eval(data)).each(function () {
value += "【id:" + this.id
+ "; name:" + this.name
+ "; Areapath:" + this.Areapath
+ "; Iteration:" + this.Iteration
+ "; Description:" + this.Description
+ "; StartDate:" + this.StartDate
+ "; EndTime:" + this.EndTime
+ "; Description:" + this.Description
+ ";Links:" + this.Links
+ ";State:" + this.State
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} //根据测试计划查询测试套件
function CaseSuit() {
$.ajax({
type: "post",
url: "http://localhost:8080/TfsWebApi/api/TestSuit/GetTestSuitFromPlan",
data: "{'collectionName':'WX201512','projectName':'WX20151207','testPlanIds':'251,428,436'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var value = "";
$(eval(data)).each(function () {
value += "【planid:" + this.planId
+ "; id:" + this.id
+ "; title:" + this.Title
+ "; State:" + this.State
+ "; Description: " + this.Description
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} //根据测试套件查询执行用例
function CaseSearch() {
$.ajax({
type: "post",
url: "http://localhost/TfsWebApi/api/TestDoCase/GetTestDoCaseFromSuit",
data: "{'collectionName':'WX201512','projectName':'WX20151207','testSuitids':'252,253,307','testPlanIds':'428,436'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var value = "";
$(eval(data)).each(function () {
value += "【planId:" + this.planId
+ "; planName:" + this.planName
+ "; suitId:" + this.suitId
+ "; suitName:" + this.suitName
+ "; testCaseId:" + this.testCaseId
+ "; testCaseName:" + this.testCaseName
+ "; testRunId:" + this.testRunId
+ "; testRunDateDue:" + this.testRunDateDue
+ "; testRunState:" + this.testRunState
+ "; testRunTime:" + this.testRunTime
+ "; testRunMan:" + this.testRunMan
+ "; buglinks:" + this.buglinks
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} //查询用例详情
function GetDetailsOfTestCase() {
$.ajax({
type: "post",
url: "http://localhost:8080/TfsWebApi/api/TestCase/GetDetailsOfTestCase",
data: "{'collectionName':'项间需求2','projectName':'项间需求项目2','testCaseIds':'332,351,352,362,363'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var json = jQuery.parseJSON(data);
var value = "";
$(json.data).each(function () {
value += "【TestCaseId:" + this.TestCaseId
+ "; TestPlanId:" + this.TestPlanId
+ "; TestPlanName:" + this.TestPlanName
+ "; Description:" + this.Description
+ "; AssignedTo:" + this.AssignedTo
+ "; AreaPath:" + this.AreaPath
+ "; IterationPath:" + this.IterationPath
+ "; State:" + this.State
+ "; Reason:" + this.Reason
+ "; TestEnvironment:" + this.TestEnvironment
+ "; AutomatedTestStorage:" + this.AutomatedTestStorage
+ "; AutomatedTestType:" + this.AutomatedTestType
+ "; Tested:" + this.Tested
+ "; Attachments:" + this.Attachments
+ "; AllLinks:" + this.AllLinks
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} </script>
</head>
<body>
<div style="width:200px; margin:200px auto;"> <input id="BtnExport" type="button" value="查询测试计划 " class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnCaseSuit" type="button" value="查询测试套件" class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnCaseSearch" type="button" value="查询执行用例" class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnWorkItemDetails" type="button" value="查询工作项详情 " class="btn btn-default btn-sm btn_style" /><br />
<input id="BtnUpdateTestCaseResult" type="button" value="更新测试用例执行结果 " class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnGetDetailsOfTestCase" type="button" value="查询测试用例详情 " class="btn btn-default btn-sm btn_style" />
</div>
<div id="valuesshow"></div> </body>
</html>
8.ajax查询数据的更多相关文章
- ajax查询数据返回结果不变
在使用流水号的时候,Google浏览器没有问题,但是IE有缓存,如果ajax请求的参数没有变化,那么就会返回缓存里的数据 解决方法:ajax请求的时候传值的参数设置一个时间戳就OK了(没什么特别意义, ...
- ajax查询数据的举例
1.根据下拉框的值异步查询信息 HTML代码如下: <script> $(function(){ //页面载入时执行 $("#key").change(function ...
- jquery通过ajax查询数据动态添加到select
function addSelectData() { //select的id为selectId //清空select中的数据 $("#selectId").empty(); $.a ...
- 查询数据过多页面反应慢引入缓存解决方案(Redis、H2)
问题:原系统查询接口不支持分页也不可能加入分页支持,导致Ajax查询数据过多,返回数据达到2W多条记录时响应已经极慢,查询功能不要求数据实时性,页面反应速度极慢.体验不好:经排查是由于数据量过大导 ...
- ASP.NET 前端Ajax获取数据并刷新
控制器中↓ /// <summary> /// 根据ID来进行展示数据 /// </summary> /// <param name="instru_id&qu ...
- 5月17 利用AJAX查询数据库
利用AJAX查询数据 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// ...
- vue使用element Transfer 穿梭框实现ajax请求数据和自定义查询
vue使用element Transfer 穿梭框实现ajax请求数据和自定义查询 基于element Transfer http://element-cn.eleme.io/#/zh-CN/comp ...
- 通过ajax GET方式查询数据,Django序列化objects
点击“查找2”按钮,通过ajax GET方式进行查询数据,这样页面不需要整体刷新,之后清空tbody数据,将查询结果重新附加到tbody 前端html: <div class="box ...
- AC中保存数据与查询数据
//保存数据 hui.ajax(function (ret, err) { }, url, {values: {t:"test",m:"Search",c:&q ...
随机推荐
- map用法小例子
一. Map< Key , Value > m_Eg; 一般赋值表示成: TypeElem value; m_Eg[key] = value; 或 m_Eg.insert(make_ ...
- (转)I 帧和 IDR 帧的区别
I 帧和 IDR 帧的区别:http://blog.csdn.net/skygray/article/details/6223358 IDR 帧属于 I 帧.解码器收到 IDR frame 时,将所 ...
- winform程序_根据输入的sql生成excel(字段名与sql一致)
自己打开看吧 app.config可配置数据库路径 excel保存路径.... 源码下载链接: http://pan.baidu.com/s/1bnHPhdd
- 今天搞log4net插入错误日志去mysql数据库的时候出现了点问题,已解决。记录下解决方案
先上图 配置log4net的时候要填这项,可是这个value我不知道啊.....上图里的value是我用下面的方法获取的 MySqlConnection con = new MySqlConnecti ...
- C# Asp.net 制作一个windows服务
那下面就来说说如何制作一个服务来 实现开机自动启动,每隔一段时间向student表中插入数据. 步骤: 1) 新建项目 ---> Windows 服务 2) 拖放Times控件 工具箱中 ...
- Linux 代理设置
apt proxy vim /etc/apt/apt.conf Acquire::http::proxy "http://10.48.127.169:8080/"; Acquire ...
- [dubbo] dubbo 基础使用
Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案.简单的说,dubbo就是个服务框架,如果没有分布式的需求,其实是不需要用的,只有在分布式的时候 ...
- 《R语言入门》语言及环境简单介绍
简单介绍 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/diss ...
- Codeforces Round #277.5 (Div. 2)部分题解
A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- js 获取图片url的Blob值并预览
1)使用 XMLHttpRequest 对象获取图片url的Blob值 //获取图片的Blob值 function getImageBlob(url, cb) { var xhr = new XMLH ...