我正在使用线索提示打开带有pm系统的弹出窗口。当我发布pm时,Jquery没有接收到任何字段中的值。这是一个JsFiddle,有人能帮上忙吗?html表单
<div class="interactContainers" id="private_message1">
<form action="javascript:sendPM();" name="pmForm" id="pmForm" method="post">
<font size="+1">Sending Private Message to <strong><em><?php echo "$username"; ?></em></strong></font><br /><br />
Subject:
<input name="pmSubject" id="pmSubject" type="text" maxlength="64" style="width:90%;" />
Message:
<textarea name="pmTextArea" id="pmTextArea" rows="8" style="width:90%;"></textarea>
<input name="pm_sender_id" id="pm_sender_id" type="hidden" value="<?php echo $sessionid ?>" />
<input name="pm_sender_name" id="pm_sender_name" type="hidden" value="<?php echo $user ?>" />
<input name="pm_rec_id" id="pm_rec_id" type="hidden" value="<?php echo $profileid ?>" />
<input name="pm_rec_name" id="pm_rec_name" type="hidden" value="<?php echo $username ?>" />
<input name="pmWipit" id="pmWipit" type="hidden" value="<?php echo $thisRandNum ?>" />
<span id="PMStatus" style="color:#F00;"></span>
<br /><input name="pmSubmit" type="submit" value="Submit" />
<span id="pmFormProcessGif" style="display:none;"><img src="../_Images/loading.gif" width="28" height="10" alt="Loading" /></span></form>
</div>jquery
$('#pmForm').on('submit', function (e) {
e.preventDefault();
$('input[type=submit]', this).attr('disabled', 'disabled');
var pmSubject = $("#pmSubject").val();
var pmTextArea = $("#pmTextArea").val();
var url = "../_Scripts/private_msg_parse.php";
if (!pmSubject)
{
$('input[type=submit]',this).removeAttr('disabled');
$("#jqueryReply").html('<img src="../_Images/round_error.png"
alt="Error" width="31" height="30" /> Please type
a subject.')
.show().fadeOut(6000);
return false;
}
else if (!pmTextArea) {
$('input[type=submit]', this)
.removeAttr('disabled');
$("#jqueryReply").html('<img src="../_Images/round_error.png"
alt="Error" width="31" height="30" /> Please type in your
message.')
.show().fadeOut(6000);
return false;
} else {
$("#pmFormProcessGif").show();
$.post(url, $('#pmForm').serialize(), function (data) {
$("#jqueryReply").html(data).show().fadeOut(10000);
$("#pmTextArea").val('');
$("#pmSubject").val('');
$("#pmFormProcessGif").hide();
});
}
});谢谢
发布于 2014-01-03 23:36:16
我不确定是否有线索提示,但我认为表单字段值不会被传递,因为它们在一个隐藏的容器中-- .interactContainers的CSS值为display:none。您可以保留该名称,并尝试如下所示
$('#private_message').on("click", function(){
$('.interactContainers').css('display','block')
});或者,也许有一种方法可以将其集成到您的线索提示代码中?
https://stackoverflow.com/questions/20891824
复制相似问题