In this example, you will see how to load text file by using jQuery load method, I will use jQuery load method to load text file from server and used block UI plugin to block the screen when you will click the button and screen will remain block till the function executed.
Syntax
.load( url [, data] [, complete(responseText, textStatus, XMLHttpRequest)] )
Here’s an example
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>aspxtutorial.com | Load text file by using jQuery in asp.net</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://jquery.malsup.com/block/jquery.blockUI.js?v2.38"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#Button1').click(function () {
$.blockUI({ message: '<h1> Processing...</h1>' });
$("#result").load("loadtextfile.txt", function (response, status, xhr) {
if (status == "error") {
$("#result").html(xhr.status + " " + xhr.statusText);
$.unblockUI();
}
$.unblockUI();
});
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text=" Click to load file " />
<div id="result">
</div>
</form>
</body>
</html>
Output

Download
Load-text-file.rar (1.06 kb)
See live demo