title: CodeIgniter ajax dynamic forms
body: <p>I'm actually trying to do a dynamic administration about teams in my project. It means for example, the user has 3 buttons. Each buttons calls a function from a controller that displays a form.</p>
  
  <p>However, when the form appears, the url is wierd when i press submit.</p>
  
  <pre><code>function ajax_get(){
  
  var uri_segment = "&lt;?=$this-&gt;uri-&gt;segment(3);?&gt;";
  
  $('#editTeam').click(function (e) {
      e.preventDefault();
  
      $.ajax({
          type : "GET",
          async : false,
          url : "&lt;?=base_url().'ajax/team/get_editTeam/';?&gt;"+uri_segment,
          dataType : "html",
          success : function(data){
              window.setTimeout(function () {
                  $('#divPage').html(data);
              }, 300);
  
          }
      });
      return false;
  });
  </code></pre>
  
  <p>This function display a view in a div, and then i have a form</p>
  
  <pre><code>function ajax_editTeam()
  {
  $('form').submit(function(e){
      e.preventDefault();
  
      $.ajax({
          type : "POST",
          async : false,
          url : "www.google.fr",
          data : $(this).serializeArray(),
          dataType : 'json',
          success : function(data)
          {
  
          }
      });
  
  
      return false;
  });
   }
  </code></pre>
  
  <p>For this form I have another ajax call that save the field and update the team informations. As you can see I wrote 'www.google.fr' as url but it changes nothing</p>
  
  <p>When I submit the form, I have a wierd url in firebug. </p>
  
  <p><strong>This is the console from firebug :</strong>
  GET <a href="http://fresh-league.com/ajax/team/get_editTeam/30" rel="nofollow">http://fresh-league.com/ajax/team/get_editTeam/30</a> 200 OK 164ms<br>
  POST <a href="http://fresh-league.com/ajax/team/editTeamget_editTeam" rel="nofollow">http://fresh-league.com/ajax/team/editTeamget_editTeam</a> 404 Not Found 354ms </p>
  
  <p>Can you please tell me why I have another requested url than www.google.fr ? </p>
  
  <p>Thanks for answers
  Matt</p>