Submit form then close the popup

Hi there …

i am working with codeigniter and trying to submit a form and then closing it with javascript…

i have a popup function…that i call from the parent page

 < a href = "javascript:popup('controller/method/variable', 'Click', '400', '400')">Click</a>

and here is the function:

function reject_popup(url, name, width, height){
		    var top = parseInt((screen.availHeight / 2) - (height / 2));
		    var left = parseInt((screen.availWidth / 2) - (width / 2));
		    var features = "location=1, status=1, scrollbars=1, width=" + width + ", height=" + height + ", top=" + top + ", left=" + left;
		    window.open(url, name, features);
		}

and it opens this form:


```php
&lt;?php echo form_open('state/validate_rejection/'.$file_results-&gt;sender_id.'/'.$this-&gt;session-&gt;userdata('id').'/'.$file_results-&gt;id, array('name'=&gt;'rejection_form', 'id'=&gt;'rejection_form', 'onsubmit'=&gt;'window.forms[0].submit();self.close();')); ?&gt;
		<div class="form">

			<p>
				<label>Write the reason of Rejection?<span class='req'>* Required</label>
					<textarea name="remarks" rows="8" style="width:380px; max-width:380px " autofocus required></textarea>
			</p>

		</div>
		<!-- End Form -->

		<!-- Form Buttons -->
		<div class="buttons">	

			<input type="button" class="button" value="cancel" onclick="javascript:self.close();" />
			<input name="submit_rejection" id="submit_rejection" type="submit" class="button" value="Send" />

		</div>
		<!-- End Form Buttons -->
&lt;?php echo form_close(); ?&gt;


as you can see the form action is a url that goes to a codeigniter controller/method :
here is the method i use


function validate_rejection(){

	$this->form_validation->set_rules('remarks', 'Remarks', 'trim|required');

		if($this->form_validation->run() == TRUE){

			$sender_id = $this->uri->segment(3) ? $this->uri->segment(3) : 0;
			$user_id = $this->uri->segment(4) ? $this->uri->segment(4) : 0;
			$file_id = $this->uri->segment(5) ? $this->uri->segment(5) : 0;

//here a function from codigniter model is called, and returns true if query succeded, false if it failed
$rejection = $this->files_model->reject_file($sender_id, $user_id, $file_id);

			if($rejection == TRUE){

				$this->session->set_flashdata('rejection_succ', 'Rejected Successfully');
				//redirect('home');
			}
			else{

				$this->session->set_flashdata('rejection_fail', 'Rejection of file Failed');
			}
		}
		else{
			$this->session->set_flashdata('remarks_validation_errors', validation_errors());
		}
}


and if the form is submitted successfully or failed it will set a flashdata

NOW I WANT THAT WHEN THE FORM IS SUBMITTED TO CHECK IF FORM IS FINISHED, RELOAD THE PARENT PAGE AND CLOSE THE POPUP....
Can anyone please help me achieve that?

Hi haris244808 ,
i do have the same requirement, did you find any solution