Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Jquery数据表中调用函数_Javascript_Jquery_Html - Fatal编程技术网

Javascript 如何在Jquery数据表中调用函数

Javascript 如何在Jquery数据表中调用函数,javascript,jquery,html,Javascript,Jquery,Html,我有这些代码行。我想给某行添加函数。单击时,它将运行另一个函数。但它不能识别函数声明。单击某一行时如何调用函数?以及如何向与该行关联的函数发送参数 $(文档).ready(函数(){ var restVul=函数(){ 警报(“tik”); } $.ajax({ url:“https://localhost:450/rest/products?pageNumber=1&pageCount=80", 类型:“POST”, 数据类型:“json”, 标题:{ “内容类型”:“应用程序/json” }

我有这些代码行。我想给某行添加函数。单击时,它将运行另一个函数。但它不能识别函数声明。单击某一行时如何调用函数?以及如何向与该行关联的函数发送参数

$(文档).ready(函数(){
var restVul=函数(){
警报(“tik”);
}
$.ajax({
url:“https://localhost:450/rest/products?pageNumber=1&pageCount=80",
类型:“POST”,
数据类型:“json”,
标题:{
“内容类型”:“应用程序/json”
},
传统的:是的,
contentType:“应用程序/json;字符集=utf-8”,
processData:false,
数据:JSON.stringify(主机地址),
成功:功能(响应){
控制台日志(响应);
对于(变量i=0;i
在行中使用以下代码

columns: [
{"data": "xxx", "width": "10%","visible": false, "render": function (data, type, row, meta) {   }    },
]
在函数中使用以下代码在列上创建可单击的链接

if (type === 'display') {
        return $('<a>')
        .attr('href', ' ')
        .text(data)
        .wrap('<div></div>')
        .parent()
        .html();
     } else {
          return data;
     }
if(类型=='display'){
返回$('')
.attr('href','')
.文本(数据)
.wrap(“”)
.parent()
.html();
}否则{
返回数据;
}

在行中使用以下代码

columns: [
{"data": "xxx", "width": "10%","visible": false, "render": function (data, type, row, meta) {   }    },
]
在函数中使用以下代码在列上创建可单击的链接

if (type === 'display') {
        return $('<a>')
        .attr('href', ' ')
        .text(data)
        .wrap('<div></div>')
        .parent()
        .html();
     } else {
          return data;
     }
if(类型=='display'){
返回$('')
.attr('href','')
.文本(数据)
.wrap(“”)
.parent()
.html();
}否则{
返回数据;
}

向项目添加内容还有其他方法吗?您想做什么告诉我您的用例我将帮助您我想添加onclick事件使用新添加的代码在列上创建可单击链接有其他方法向项目添加内容吗?您想做什么告诉我您的用例我将帮助您我想向项目添加onclick事件使用新添加的代码在列上创建可单击的链接