<extend name="Public/base" />
<block name="main">
<p class="main-wrap">
<p class="crumb-wrap">
<p class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin">首页</a><span class="crumb-step">></span><span class="crumb-name">链接管理</span></p>
</p>
<p class="search-wrap">
<p class="search-content">
<form action="/jscss/admin/design/index" method="post">
<table class="search-tab">
<tr>
<th width="120">选择分类:</th>
<td>
<select name="search-sort" id="">
<option value="">全部</option>
<option value="19">精品界面</option><option value="20">推荐界面</option>
</select>
</td>
<th width="70">关键字:</th>
<td><input class="common-text" placeholder="关键字" name="keywords" value="" id="" type="text"></td>
<td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
</tr>
</table>
</form>
</p>
</p>
<p class="result-wrap">
<form name="myform" id="myform" method="post" action="__CONTROLLER__/sort">
<p class="result-title">
<p class="result-list">
<a href="__CONTROLLER__/add"><i class="icon-font"></i>新增链接</a>
<a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i><input type="submit" name="" value="更新排序"></a>
</p>
</p>
<p class="result-content">
<table class="table-bordered table">
<tr class="active">
<th>排序</th>
<th>ID</th>
<th>链接名称</th>
<th>链接地址</th>
<th>链接描述</th>
<th>操作</th>
</tr>
<volist name="links" id="arr">
<tr class="yjsTr">
<td>
<input class="common-input sort-input" name="{$arr.id}" value="{$arr.sort}" type="text">
</td>
<td>{$arr.id}</td>
<td><a target="_blank" href="#" title="{$arr.title}">{$arr.title}</a> …
</td>
<td><a target="_blank" href="#" title="{$arr.url}">{$arr.url}</a> …
</td>
<td><a target="_blank" href="#" title="{$arr.desc}">{$arr.desc}</a> …
</td>
<td>
<a class="link-update" href="__CONTROLLER__/edit">修改</a>
<a class="link-del" onClick="return confirm('确定删除该条数据吗?');" href="__CONTROLLER__/del/id/{$arr.id}">删除</a>
</td>
</tr>
</volist>
</table>
<p class="list-page"> 2 条 1/1 页</p>
</p>
</form>
</p>
</p>
</block>
<block name="script">
<script type="text/javascript" src="__PUBLIC__/js/libs/angularjs.js"></script>
<script type="text/javascript">
$(function(){
$('a.link-update').on('click', function(){
var $obj = $(this).parents('tr.yjsTr').children();
console.log(5);
var data = {
'title': $obj.eq(2).text(),
'url': $obj.eq(3).text(),
'desc': $obj.eq(4).text(),
}
$.ajax({
type: 'post',
data: data,
url: '__CONTROLLER__/edit',
success: function(){
window.location.href = '__CONTROLLER__/edit';
},
error: function(){
}
})
return false;
})
})
</script>
</block>
上述是lst.html中的代码,要将表单数据发送到__CONTROLLER__/edit中,下面是edit函数
public function edit(){
$link = D('Link');
if(IS_POST){
var_dump($_POST);
die;
}
// $this->display();
}
1、请问为什么没收到表单post提交的数据?
2、如果要实现应该怎么实现?
曾经蜡笔没有小新2017-05-16 13:03:26
Google Chrome에서 F12를 눌러 NetWork 탭을 찾은 다음 ajax를 실행하여 패키지 내용과 주소를 확인하세요