<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>
<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>
上述是lst.html中的程式碼,要將表單資料傳送到__CONTROLLER__/edit中,下面是edit函數
public function edit(){
$link = D('Link');
if(IS_POST){
var_dump($_POST);
die;
}
// $this->display();
}
1、請問為什麼沒收到表單post提交的資料?
2、如果要實現應該怎麼實現?
你谷歌瀏覽器按下F12找到NetWork tab下再執行你的這個ajax 看看包內容和地址
if($_POST){
var_dump($_POST[]);
}