目錄
ajax异步传递
Jun 23, 2016 pm 01:24 PM
table width="100%" border="0" cellspacing="0" cellpadding="0" class="ttbb5"> <tr> <th scope="col"><strong>序号</strong></th> <th scope="col">国家</th> <th scope="col">省份</th> <th scope="col">地区</th> <th scope="col">操作</th> </tr> {if $list or $list|@count neq 0 } {foreach from=$list item=item key=index} <tr align="center"> <td>{$index}</td> {if $item.parent_tow_id eq 2} <td class="ttbb6">{$item.country}</td> <td class="ttbb6">{$item.province}</td> <td class="ttbb6">{$item.name}</td> {/if} {if $item.parent_tow_id eq 1} <td class="ttbb6">{$item.country}</td> <td class="ttbb6">{$item.name}</td> <td class="ttbb6"></td> {/if} {if $item.parent_tow_id eq 0} <td class="ttbb6">{$item.name}</td> <td class="ttbb6"></td> <td class="ttbb6"></td> {/if} <td align="center" class="ttbb6"> <div align="right"> <input name="p" type="text" id="p" value="{$item.paixu}" size="5" maxlength="3" /> <input type="button" class="anniu4" value="确定" onclick="foo()" /> </div></td> </tr> {/foreach} {else} <tr> <td align="center" colspan="5">--暂无数据--</td> </tr> {/if} </table> {include file=warning.tpl}</div> </td> </tr></table>
登入後複製
input=text显示数据库排序的值 在文本框修改值点击确定 怎么传入数据库 改变paixu的值
帮帮忙给写一个ajax异步传递的代码吧
回复讨论(解决方案)
用表单提交你会吗?
如不会,请先学习一下
用表单提交你会吗?
如不会,请先学习一下
没明白什么意思啊 我写的不对么? 还是 ajax必须要用表单提交啊
用表单提交你会吗?
如不会,请先学习一下
<script type="text/javascript"> function modifyItem() { if (trim(document.getElementById("p").value) == "") { alert("不能为空!"); document.getElementById("p").focus(); return; } with (document.getElementById("itemForm")) { method = "post"; action = "item.do?command=modify&paixu=${itemForm.paixu}"; submit(); } } //返回 function goBack() { window.self.location = "item.do?command=list&paixu=${itemForm.paixu}"; } </script>
登入後複製
<form name="itemform" id="itemform"> <input name="p" type="text" id="p" value="{$item.paixu}" size="5" maxlength="3" /> <input type="button" class="anniu4" onclick="modifyItem()" value="确定" /> </form>
登入後複製
这里如果列表,你的名字不能重复,或者你改为name="p[]"
这里如果列表,你的名字不能重复,或者你改为name="p[]"
改成name="p[]"了 那ajax我写错了么? 我试验好几遍,不知道错在哪?
神呐 帮帮我吧 要死了 要死了 要死了
这个写个ajax很难么? 都不会啊?
不是很难。
不是很难。
服了,真心的。 我都关注你微信了大哥 你也不给帮忙 不够意思
http://bbs.phome.net/showthread-13-130691-0.html
有例子
http://bbs.phome.net/showthread-13-130691-0.html
有例子
这个例子很生动, 我先注册 然后下载了文件,看到代码发现其实我两不是一个类型的,对我这个他根本不适用啊,smarty都是那么写ajax的么? 我怎么感觉他这个文件缺点什么似的啊 ?那个save_ajax.php 我还能看懂 别的真是磕了
http://bbs.phome.net/showthread-13-130691-0.html
有例子
{
data_q = "actiontype=" + act + "&name=" + txt.value + "&id="+id+"&tid="+Math.random(10);
///document.write("save_ajax.php?"+data_q);
if(val != txt.value)
{
$("#tipmsg").show();
$.ajax({
type: "GET",
url: "save_ajax.php",
cache: false,
data: data_q,
success: function(msg){
obj.innerHTML = msg;
$("#tipmsg").hide();
}
});
}
else
{
obj.innerHTML = val;
}
} 套这个?
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱門文章
擊敗分裂小說需要多長時間?
3 週前
By DDD
倉庫:如何復興隊友
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前
By 尊渡假赌尊渡假赌尊渡假赌
公眾號網頁更新緩存難題:如何避免版本更新後舊緩存影響用戶體驗?
3 週前
By 王林

熱門文章
擊敗分裂小說需要多長時間?
3 週前
By DDD
倉庫:如何復興隊友
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前
By 尊渡假赌尊渡假赌尊渡假赌
公眾號網頁更新緩存難題:如何避免版本更新後舊緩存影響用戶體驗?
3 週前
By 王林

熱門文章標籤

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)