I am having a problem with trying to call a particular controller/method. I am trying to call myController/myMethod but instead my $_POST is being posted to myController only. I think that the reason why the $_POST is not working correctly is because of the following code:
<script type="text/javascript">
$(document).ready(function() {
var $body = $('body'),
$content = $('#content'),
$form = $content.find('#loginform');
$("input").uniform();
$form.wl_Form({
status:false,
onBeforeSubmit: function(data){
$form.wl_Form('set','sent',false);
if(data.username && data.password){
document.forms[0].submit(); // PROBLEM HERE
}else{
$.wl_Alert('Enter password','warning','#content');
}
return false;
}
});
<?php if ($error_msg != ""): ?>
$.wl_Alert('<?php echo $error_msg; ?>','info','#content');
<?php endif; ?>
});
</script>
I think that what is happening is that when there is data.username && data.password set, the form is being submitted but is not reaching the correct method that I need.
How can I modify the above javascript so that instead of submitting forms[0], the code should instead call myController/myMethod? Here is the form code showing the controller and method that I am trying to call:
<form name="login" action="<?php echo site_url(); ?>myController/myMethod" id="loginform" method="POST">
instead of
try and see what happens