Thursday, 15 August 2013

javascript - AJAX - How to run a script inside a popup menu -



javascript - AJAX - How to run a script inside a popup menu -

i have popup menu opens , displays text @ moment. want able attach controller popup menu. example: want edit profile popup display necessary inputs edit profile.

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 , conditions</p> <p class="term_full">by entering email, allow musiclear send info regarding musiclear , related services <br><br> entering email, understand can break our hearts , unsubscribe @ anypoint. <br><br> , sense free kick if ever share email address (you can trust us)</p> </center> </div>

this html behind button , popup form.

main.js:

$( "#test" ).submit(function( event ) { event.preventdefault(); document.getelementbyid('popupbox').style.visibility="visible"; });

on button click create form visible.

how can create work form in popup menu?

edit:

upload controller(what want show in popup):

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>

put function phone call within of script tags -

<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>

javascript php jquery html ajax

No comments:

Post a Comment