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