title: Codeigniter routing. AJAX get with parameters using javascript
body: <p>I want this working with Codeigniter:</p>
  
  <pre><code>name = encodeURIComponent( document.getElementById("myName").value);
  
  xmlHttp.open("GET", "quickstart.php?name=" + name, true);
  
  xmlHttp.onreadystatechange = handleServerResponse; //not relevant for question
  
  xmlHttp.send(null);
  </code></pre>
  
  <p>I have create a controller with a function with a parameter and changed the previous code:</p>
  
  <pre><code>xmlHttp.open("GET", "quickstart.php?name=" + name, true);
  </code></pre>
  
  <p>to</p>
  
  <pre><code>xmlHttp.open("GET", "ajax/quickstart/"+name, true);
  </code></pre>
  
  <p>I use this routes(but doesn't work):</p>
  
  <pre><code>$route['ajax'] = 'ajax';
  $route['ajax/quickstart'] = 'ajax/quickstart';
  $route['ajax/quickstart/([A-Za-z0-9])+'] = 'ajax/quickstart/$1';
  </code></pre>
  
  <p><strong>The problem I'm having it's I only get the last letter written. For example if I write "name", only "e" it's passed as argument. But all the word was sent.</strong>
  My controller function looks like: </p>
  
  <pre><code>public function quickstart($name='')
  {
  // we'll generate XML output
  header('Content-Type: text/xml');
  // generate XML header
  echo '&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;';
  // create the &lt;response&gt; element
  echo '&lt;response&gt;';
  // retrieve the user name
  //$name = $this-&gt;input-&gt;get('name');
  
  // generate output depending on the user name received from client
  $userNames = array('YODA', 'AUDRA', 'BOGDAN');
  if (in_array(strtoupper($name), $userNames))
      echo 'Hello, master ' . htmlentities($name) . '!';
  else if (trim($name) == '')
      echo 'Stranger, please tell me your name!';
  else
  
  echo htmlentities($name) . ', I don\'t know you!';
  // close the &lt;response&gt; element
  echo '&lt;/response&gt;';
  }
  </code></pre>