New to HMVC in Codeigniter.
Dynamic form allows new "segments" to be created when a user clicks a link.
Currently the segment html & php is in module/view/segment_view.php. The view requires dynamic php variables as well.
How can I "load the view" using jQuery? I understand I can't directly load a view from jQuery but am lost on how to structure the controller for an AJAX call. Seems this may not be a strength of Codeigniter?
EDIT:
The "segment" is inside a form. The form always has 1 segment. jQuery can add more segments. Each segment requires php arrays for form inputs and validation.
Here is a pared down version of the form_view file
for ($i=1; $i<=$number_of_segments; $i++) {
$data['location'] = array(
'name' => "segment[$i][location]",
'value' => set_value("segment[$i][location]"),
'maxlength' => '255',
'size' => '30'
);
?>
<div class="area">
<div class="row"><h2>Segment <?php echo $i;?></h2></div>
<?php
$this->load->view('module/segment_view', $data);
?>
</div> <!--/div class="area"-->
<?php
} //end for
?>
OK, so this isn't really separating application logic from presentation, now is it? Ha ha. So what is the best way to structure this so the code is HMVC and can be accessed from a php controller/view as well as jQuery?