title: Trying to define a function inside onclick
body: <p>I am trying to define a function inside onclick. It is not working and no error is showing on the console. I have called the function from the bottom of the page and I have defined the function inside <code>onclick()</code> but it is not working.</p>
  
  <pre><code> &lt;div id="content-wrapper"&gt;
  
            &lt;div class="row"&gt;
              &lt;div class="col-lg-12"&gt;
              &lt;div class="main-box clearfix"&gt;
              &lt;div class="clearfix"&gt;
                &lt;div class="common_page gsb1"&gt;
                &lt;div class="hdr"&gt;
                     &lt;div class="row"&gt;
                  &lt;div class="col-md-4"&gt;
                    &lt;h4&gt;Users&lt;/h4&gt;
                  &lt;/div&gt;
                   &lt;div class="col-md-5"&gt;
  //this is not working  
    &lt;p&gt;&lt;a href="" onclick="function send_Data(data){
                      download_csv(data)};"&gt;Download &lt;/a&gt;&lt;/p&gt;
                  &lt;/div&gt;
  
  
  
                  &lt;div class="col-md-3 pull-right"&gt;
                        &lt;%=render 'search'%&gt;
                  &lt;/div&gt; 
                &lt;/div&gt;    
                       &lt;/div&gt;
  
  
             &lt;% download_data = []%&gt;
  
                &lt;%@users.each do |user|%&gt;     
  
                   &lt;div id='content' class="tab-content"&gt;
                      &lt;div class="tab-pane active" id="all"&gt;
                        &lt;div class="row"&gt;
                        &lt;div class="col-md-4"&gt;
                          &lt;p&gt;&lt;b&gt;User Name&lt;/b&gt; &lt;span class="blue"&gt; &lt;%=user.name %&gt; &lt;/span&gt; &lt;/p&gt;
                          &lt;%download_data.push(user.name)%&gt;
                         &lt;p&gt;&lt;b&gt;user_code&lt;/b&gt; &lt;span class="blue"&gt; &lt;%=user.user_code %&gt; &lt;/span&gt;  &lt;/p&gt;
                           &lt;%download_data.push(user.user_code)%&gt;
                         &lt;p&gt;&lt;b&gt;phone&lt;/b&gt; &lt;span class="blue"&gt;&lt;%=user.phone %&gt;&lt;/span&gt;  &lt;/p&gt;
                          &lt;%download_data.push(user.phone)%&gt;
  
                      &lt;/div&gt;
                     &lt;/div&gt;
                 &lt;/div&gt;
  
                &lt;%end%&gt;
  
                &lt;div data-no-turbolink&gt;
                  &lt;%if @users.length &gt; 1%&gt;
                    &lt;%= will_paginate @users %&gt;
                  &lt;% end %&gt;
                &lt;/div&gt;  
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
            &lt;footer id="footer-bar" class="row"&gt;
              &lt;p id="footer-copyright" class="col-xs-12"&gt;
                Powered by abcadas
              &lt;/p&gt;
            &lt;/footer&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;script &gt;
         $("#zsales").attr("class","active")
  
         send_Data("&lt;%=download_data%&gt;")
    &lt;/script&gt;
  </code></pre>