我试着解决这一天,但我不能,不知道我应该做什么...... 然后我寻找帮助,我想知道是否有人可以帮助我如何解决它,我已经难倒,问题是当我点击发送按钮时,只有“等待”文字出现,即使我没有t填充任何字段然后只'等待'文本... 它似乎我的jquery不读取任何字段.. 为了你的帮助,我将不胜感激并感谢。
<div class="heading" id="short_msg"> </div>
<form id="send_to_">
<table>
<tr>
<td width="150"><span class="required">*</span> <?php echo $entry_mail_to; ?></td>
<td><input type="text" name="mail_to" value="<?php echo $mail_to; ?>" /></td>
</tr>
<tr>
<td width="150"><span class="required">*</span> <?php echo $entry_subject; ?></td>
<td><input type="text" name="subject" value="<?php echo $subject; ?>" /></td>
</tr>
<a onclick="send__to();" class="button"><span><?php echo $button_email_to; ?></span></a>
</table>
</form>
以下是jquery
<script type="text/javascript"><!--
function send__to() {
$.ajax({
type: 'POST',
url: 'index.php?pe=submit_to&sid=<?php echo $sid; ?>&customer_id=<?php echo $customer_id; ?>',
dataType: 'json',
data: $("#send_to_").serialize(),
// data: 'mail_to=' + encodeURIComponent($('input[name=\'mail_to\']').val()) + 'subject=' + encodeURIComponent($('input[name=\'subject\']').val()),
beforeSend: function() {
$('.success, .warning').remove();
$('#short_msg').after('<div class="wait"><img src="image/loading_1.gif" alt="" /> <?php echo $text_wait; ?></div>');
},
complete: function() {
$('.wait').remove();
},
success: function(data) {
if (data.error) {
$('#short_msg').after('<div class="warning">' + data.error + '</div>');
}
if (data.success) {
$('#short_msg').after('<div class="success">' + data.success + '</div>');
// $('input[name=\'"mail_to\']').val('');
// $('input[name=\'subject\']').val('');
}
}
});
return false;
}
//--> </script>
答案 0 :(得分:2)
到目前为止,最可能的事情是您的Ajax POST失败了。如果您在Firefox上运行它,请使用Firebug查看发布的内容以及返回的内容。美元到甜甜圈,Ajax调用不返回合法JSON。