ajax 无刷新更新内容
ajax 无刷新更新内容
本例无更新数据库的部分,如果想要更新数据库可以参考本站其他的类似效果,例如《jquery表格可编辑修改表格里面的值,点击td变input无刷新更新表格》
XML/HTML Code
- <ul class="users">
- <li>
- <input type="text" name="user[]" value="Jimmi Westerberg" />
- </li>
- <li>
- <input type="text" name="user[]" value="Buddy Carlson" />
- </li>
- <li>
- <input type="text" name="user[]" value="Steve Martin" />
- </li>
- <li>
- <input type="text" name="user[]" value="Babe Ruth" />
- </li>
- </ul>
- <br/>
- <a name="save_on_the_go"></a>
- This will give the following editme field:
- <input type="text" id="most_options" value="Jimmi Westerberg" />
- <br/>
- </div>
- <script type="text/javascript">
- $(document).ready(function() {
- $('ul.users input').editme();
- // uses the autosave option
- $('#save_me').editme({
- 'autosave': function(data_to_save) {
- $.post(
- 'save_data.json',
- data_to_save, function(data) {
- // do whatever you want with the data returned
- // ...
- // REMEMBER TO CALL THIS METHOD!
- // else the display view is not shown and it will be stuck at the
- // edit more.
- $('#save_me').editme('saved');
- }
- );
- }
- });
- // uses most options as an example
- $('#most_options').editme({
- 'edittext':'Edit me!',
- 'removetext': 'Delete this row',
- 'removeable':true,
- 'savetext':'Save for later...',
- 'canceltext':'Oopsie, cancel!'
- });
- });
- </script>
相关推荐
周公周金桥 2020-09-06
大象从不倒下 2020-07-31
AlisaClass 2020-07-19
MaureenChen 2020-04-21
xingguanghai 2020-03-13
teresalxm 2020-02-18
木四小哥 2013-05-14
SoShellon 2013-06-01
Simagle 2013-05-31
羽化大刀Chrome 2013-05-31
waterv 2020-01-08
LutosX 2013-07-29
vanturman 2013-06-27
wutongyuq 2013-04-12
luoqu 2013-04-10
ChinaWin 2020-08-13
kangtingting0 2020-05-20
MichelinMessi 2020-02-19