<pre name="code" class="html"> function getAppList(env){
var data = {};
data.env = env;
var successfn = function(jdata){
$(".deploy_list").html("");
_HTML = "<tr><th>发布清单</th></tr>";
$.each(jdata,function(i,val){
_HTML = _HTML + "<tr><td class='p_text'>"+val+"</td></tr>";
});
$(".deploy_list").html(_HTML);
};
var errorfn = function(jdata){
alert("数据返回出错");
};
$.ajax({
type: "get",
data: data,
url: "/DEVOPS/index.php/Automation/getAppList",
dataType: "json",
success: function(d){
successfn(d);
},
error: function(e){
errorfn(e);
}
});
}
ajax 传递参数给接口,参数js从页面传进来
ajax 调用接口,数据传递给Js函数
接口名字:url: "/DEVOPS/index.php/Automation/getAppList",
function getAppList(env){
var data = {};
data.env = env;
传递的参数:
$.ajax({
type: "get",
data: data,
html 传入js:
<label class="condition">环境</label>
<select name="env" class="deployment">
<option value="uat">uat</option>
<option value="hy">黄鱼</option>
$(function(){
var _env_select = $("select[name='env']");
var _app_select = $("select[name='app']");
var _sub_btn = $(".deployment_to");
var env = "uat";