javascript onclick 甚至处理程序显示表单
我想将一个变量传递到另一种形式,当单击某个单选按钮时,该变量会显示出来。但是不确定执行此操作的最佳方法,因为不想刷新页面。
用于打开表单的 javascript 是:
$(document).ready(function(){
$(".col3flex").css("display","none");
$(".category").click(function(){
if ($('input[name=category]:checked')) {
$(".col3flex").slideDown("fast");
} else {
$(".col3flex").slideUp("fast"); //Slide Up Effect
}
});
});
我现在需要做的是传递单选按钮值,以便由我的 php select 语句选取,以便显示正确的值。
我将如何实现这个请
谢谢
I am wanting to pass a variable through to another form that will reveal itself when a certain radio button is clicked. However not sure the best way to do this as do not want to refresh the page.
the javascript for the form opening is:
$(document).ready(function(){
$(".col3flex").css("display","none");
$(".category").click(function(){
if ($('input[name=category]:checked')) {
$(".col3flex").slideDown("fast");
} else {
$(".col3flex").slideUp("fast"); //Slide Up Effect
}
});
});
what i need to do now, is pass the radio button value to be picked up by my php select statement in order to display the correct values.
How would i implement this please
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信您在使用事件处理程序并检查单选按钮的值时遇到了问题。我认为这就是您所需要的(我假设“.category”是单选按钮?)
I believe that you're having trouble with the event handler and then checking for the value of the radio button. I think this is what you need (I assume that ".category" is the radio button?)
如果您需要通过 PHP 加载一些后端信息,您将无法使用 AJAX - 特别是如果您需要此类信息而不重新加载页面。
您需要发送 AJAX 请求并填充所需的元素及其信息,然后再向下滑动
.col3flex
元素。如果这不完全是您想要的,您需要进一步详细了解您的问题。
If you need to load some backend-informations via PHP you won't come around AJAX - especially if you need such informations while not reloading the page.
You need to send the AJAX-request and fill the needed elements which its information before sliding the
.col3flex
-element down.If thats not quite what you wanted, you need to go further into details regarding your problem.
您好,您可以向任何其他页面发送 ajax 请求,该请求将为您提供其他选择。在点击事件中,只需向其他页面发送 ajax 请求
,您的
somepage.php
文件将获取post
数据并生成下拉列表hi you can send an ajax request to any other page that will render you other select. At on click event just send an ajax request to some other page
And your
somepage.php
file will get thepost
data and generate the dropdown