我正在一个网站上工作,我正在更新D & D字符的信息。在这个特定的页面上有可编辑的div,在其中我通过(非常不一致的)ajax POST脚本进行更改和提交。
不知何故POST不会提交任何更改,它可能是完全随机的。有时它可以工作并更新数据库,有时它不会。当然,这是不可能为你们做一个POST到我的服务器,但阿贾克斯如下:这里
<script type="text/javascript">
$(document).ready(function() {
$("#actor_result").load('xml/actortoxml.php?owner=cederman&id=2');
$('#save_editable').click(function() {
var name = $(document).find('#actorname').text();
var current = $(document).find('#currenthealth').text();
var max = $(document).find('#maxhealth').text();
var effects = $(document).find('#actoreffects').text();
var notes = $(document).find('#actornotes').text();
$.ajax({
url: 'actor_profile.php',
type: 'POST',
data: {
update: 'true',
actorid: 2,
actorname: name, currenthealth: current, maxhealth: max, actoreffects: effects, actornotes: notes
},
});
window.location = 'actor_profile.php?id=2'
});
/*
var refreshId = setInterval(function() {
$("#actor_result").load('xml/actortoxml.php?owner=cederman&id=2');
}, 300000);
$.ajaxSetup({ cache: false });
*/
});
</script>
检查捣鼓说明: http://jsfiddle.net/CgLmW/2/
您是否尝试过没有window.location行? –
嗯,我现在试过了,它似乎修复它,奇怪=/ – Marty
它可以自动保存吗? – Marty