Hi phanlawi,
I have created sample that full-fill your requirement.
Test.txt
ASP.Net MVC: Call Controller Method from View using jQuery AJAX
Here Mudassar Ahmed Khan has explained with an example, how to call the Controller method with parameters from View using jQuery AJAX in ASP.Net MVC 5 Razor.
In this article I will explain with an example, how to call the Controller method with parameters from View using jQuery AJAX in ASP.Net MVC 5 Razor.
Code
string[] lines = System.IO.File.ReadAllLines(Server.MapPath("~/Test.txt"));
int totalLine = lines.Length;
string charactersCount = string.Empty;
for (int i = 1; i <= lines.Length; i++)
{
charactersCount += "Characters count in line " + i + " is : " + lines[i - 1].Length + "<br />";
}
Response.Write("Total Line Count : " + totalLine + "<br />" + charactersCount);
Output
Total Line Count : 4
Characters count in line 1 is : 63
Characters count in line 2 is : 0
Characters count in line 3 is : 157
Characters count in line 4 is : 149