我有一个弹出菜单,此菜单打开并显示文本。我想要的是能够将控制器附加到弹出菜单。例如:我希望显示一个编辑配置文件弹出窗口,其中包含编辑该配置文件的所有必要输入。
userprofile_view.php:
<div class="upload">
<?php
$data = array('id' => 'test');
echo form_open('', $data);
echo form_submit('upload', 'Upload');
echo form_close();
?>
</div>
<div id="popupbox">
<center>
<p class="head">Terms and Conditions</p>
<p class="term_full">By entering your email, you allow Musiclear to send you information regarding Musiclear and
related services <br><br> By entering your email, you also understand that you can break our hearts and unsubscribe
at anypoint. <br><br> And feel free kick us if we ever share your email address (you can trust us)</p>
</center>
</div>
这是按钮和弹出表单后面的html。
main.js:
$( "#test" ).submit(function( event ) {
event.preventDefault();
document.getElementById('popupbox').style.visibility="visible";
});
在按钮上单击我使表格可见。
如何使用弹出菜单中的表单来实现此目的?
编辑:
上传控制器(我想在弹出窗口中显示的内容):
function do_upload_profilepicture()
{
$this->load->model('model_users');
$userID = $this->model_users->getUserID($this->session->userdata('username'));
$config['upload_path'] = './img/profilepictures/';
$config['allowed_types'] = 'jpg|png';
$config['overwrite'] = TRUE;
$config['file_name'] = $userID;
$config['max_size'] = '500';
$config['max_width'] = '1920';
$config['max_height'] = '1028';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_profilepic_form', $error);
}
else
{
$upload_data = $this->upload->data();
$resize['image_library'] = 'gd2';
$resize['source_image'] = $upload_data['full_path'];
$resize['maintain_ratio'] = FALSE;
$resize['width'] = 180;
$resize['height'] = 180;
$this->load->library('image_lib', $resize);
$this->image_lib->resize();
$this->image_lib->clear();
$this->model_users->setProfilePic($userID, $upload_data['orig_name']);
$this->create_thumb($upload_data['orig_name']);
redirect('userprofile/home/' . $userID);
}
}
userprofile_view.php(popupbox):
<div id="popupbox">
<?php echo form_open_multipart('upload/do_upload_profilepicture');?>
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="submit" value="upload" />
</form>
</div>
javascript大神给出的解决方案
将函数调用放在脚本标签中-
<div id="popupbox">
<?php
echo '<script type="text/javascript">';
echo "form_open_multipart('upload/do_upload_profilepicture');";
echo '</script>';
?>
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="submit" value="upload" />
</form>
</div>
如果复选框切换复选框已选中,则在切换div中输入必填字段 - javascript我使用脚本用JavaScript切换了一些div。如果要选中复选框以显示toogle div,我想在toogle div中设置一些“必填”输入字段。有人能弄清楚吗?那是工作吗?function show(id) { if(document.getElementById) { var mydiv = document.getElementById(id); m…
ajax正在加载页面以返回POST请求 - javascript当我通过ajax发出“ POST”请求时,返回请求时页面正在加载。我们不使用ajax阻止整个页面重新加载吗?这是我的html代码:<form method="post"> <div align="center" class="col-md-10"> <input typ…
服务器响应后如何在Symfony2中显示警报或信息消息而无需重新加载页面 - javascript我正在用Symfony2为配镜师创建一个管理应用程序。当管理员将新客户添加到数据库时,我的控制器将检查客户名称是否重复。我想显示一个弹出对话框,询问用户是否要添加新客户。我该如何实施?我应该使用Ajax吗?这是我在这种情况下使用的控制器的示例代码:public function nouveauAction(Request $request) { $form …
如何正确将php变量传递给Ajax调用? - javascript我有三个文件。我的主要php文件,functions.php,然后是我的js文件。如何将这个php变量传递给js?这是我的主要PHP文件的代码function ccss_show_tag_recipes() { global $post; global $wp; $html = ''; $url = home_url( $wp->r…
提交初始化后删除某些帖子数据 - javascript在初始化提交之后但在将数据发送到处理页面之前,是否可以过滤$ _POST表单数据?我想象过程的方式:提交->收集$ _POST数据->发送数据我想做的事:提交->收集$ _POST数据->删除某些元素->发送数据这样就不必更改处理页面以过滤掉不希望接收的元素了吗? javascript大神给出的解决方案 当然可以,您可以在JS …