title: Pass JavaScript variable to C# method in MVC
body: <p>I'm trying to do the following in MVC: I have been trying to call a C# Method <code>ReplaceSpecialCharactersInURL</code> from JavaScript as follows</p>
  
  <pre><code>var SuppName= obj.data('suppliername');
  var NewSupp= '@Common.ReplaceSpecialCharactersInURL(SuppName)';
  </code></pre>
  
  <p>But it throws me an error as follows :</p>
  
  <blockquote>
    <p>The name 'SuppName' does not exist in the current context</p>
  </blockquote>
  
  <p>On the other hand it runs ok when I pass the name directly as this</p>
  
  <pre><code>var NewSupp= '@Common.ReplaceSpecialCharactersInURL("NewName")';
  </code></pre>
  
  <p>What I can make out is I cant pass JavaScript variable to c# Method</p>
  
  <p>Let me know if such a thing is possible, and if so, then how.</p>