title: codeigniter where to put common js php code
body: <p>I have a site developed in codeigniter.<bR>
  In many page of my site I have more equal function javascript/jquery with some string in PHP like this:</p>
  
  <pre><code>function change_city_by_nation(nation_id){
          var site_url_city ="&lt;?php echo(site_url('/backend/city/get_city_by_nation_id')); ?&gt;";
          $.ajax({   
              url: site_url_city, 
              async: false,
              type: "POST", 
              data: "nation_id="+nation_id, 
              dataType: "html", 
  
              success: function(data) {
                  $('#city').empty();
                  $(data +' option').each(function(index){
                      $('#city').append($(this).html());
                  });
                  $('#city').prepend("&lt;option value='0' selected='selected'&gt;Tutte le città&lt;/option&gt;");
              }
           });
      }
  </code></pre>
  
  <p>Where is the best place to collect all this javascript function with some string in php?
  - JS file (but I have to pass the php string when I call it)<br>
  - Helper (but how?)<br>
  - file php where declare the function JS like common.php(but where to put it and how to call it?)<br></p>
  
  <p>Have you some solution for my scope?
  Thanks</p>