As generally we do in asp.net project, I have created a global resource file for storing common error messages, info messages, labels etc in my first MVC4 project. I used ready-made validation.js for giving validation. I have face the problem how to get the resource file’s object value in .js file. From come out this problem I have find a way. I had create a controller ‘ResoruceScript’. And added below code in ActionResult method.
Then create a view for “Index” Action. And remove the html content, all tags which are added by default when we create a new view. And below code.
Now, you are able to get the resource file’s object value as ‘Resources.rfv_Common_Msg’ in .js file.