【发布时间】:2011-10-20 12:58:02
【问题描述】:
我正在尝试在一个 do while 循环中发送多个帖子,但未添加结果
<script type="text/javascript">
function action() {
var initval = 1;
var endval = 5;
do {
var action_string = 'txtuser=someone';
$.ajax({
type: "POST",
url: "http://localhost/js.php",
data: action_string,
success: function(result){
$('div#append_result').append(initval + ',<br/>');
}
});
initval++;
} while (initval <= endval);
}
</script>
输出是: 5、 5、 5、 5、 5、
我需要输出为: 1、 2、 3、 4、 5、
【问题讨论】:
标签: javascript ajax while-loop do-while