title: Pass ajax form value to controller codeigniter
body: <pre><code> &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  
              &lt;script type="text/javascript"&gt;
                                      $(document).ready(function () {
                      $('form.ajax-form').onclick('login_submit', function() {
                          var obj = $(this), // (*) references the current object/form each time
                              url = obj.attr('action'),
                              method = obj.attr('method'),
                              data = {};
  
                          obj.find('[user_email]').each(function(index, value) {
                              // console.log(value);
                              var obj = $(this),
                                  email = obj.attr('user_email'),
                                  value = obj.val();
  
                              data[email] = value;
                          });
  
                          obj.find('[user_pass]').each(function(index, value) {
                              // console.log(value);
                              var obj = $(this),
                                  pwd = obj.attr('user_pass'),
                                  value = obj.val();
  
                              data[pwd] = value;
                          });
  
                          $.ajax({
                              // see the (*)
                              url: url,
                              type: method,
                              data: data,
                              success: function(response) {
                                  console.log(response);
                                  // $("#feedback").html(data);
                              }
                          });
  
                          // console.log('Trigger');
                          return false; //disable refresh
                      });
                  });
              &lt;/script&gt;
              &lt;?php echo form_open('welcome/login', array('class' =&gt; 'ajax-form','style'=&gt;'z-index: 202')); ?&gt;
  
              &lt;input name="user_email" type="email" class="login_email" placeholder="Email address" required autofocus&gt;
              &lt;br /&gt;
              &lt;input name="user_pass" type="password" class="login_pass" placeholder="Password" required&gt;
              &lt;label class="checkbox"&gt;
                  &lt;a href="#" class="forgot_pass"&gt;Forgot login details?&lt;/a&gt;
                  &lt;button class="btn btn-lg btn-info" id="login_submit" style="margin-left:20px;"&gt;Sign in&lt;/button&gt;
              &lt;/label&gt;
                      &lt;/form&gt;
              &lt;?php if(isset($login_error) &amp;&amp; $login_error !=='') { ?&gt;&lt;div class="alert alert-danger login_err"&gt;&lt;?php echo $login_error; ?&gt;&lt;/div&gt; &lt;?php } ?&gt;
              &lt;!--                    &lt;/div&gt;--&gt;
  </code></pre>
  
  <p>Hi i am trying to pass the email and password to the controller in codeigniter.</p>
  
  <p>Any idea how to do that please help?</p>