<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Text from file &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/text-from-file/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Fri, 17 Jul 2015 12:41:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Text from file &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Load Contents From Text File using jQuery</title>
		<link>https://mail.sibeeshpassion.com/load-contents-from-text-file-using-jquery/</link>
					<comments>https://mail.sibeeshpassion.com/load-contents-from-text-file-using-jquery/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 29 Mar 2015 20:27:58 +0000</pubDate>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Load contents]]></category>
		<category><![CDATA[Text from file]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1701</guid>

					<description><![CDATA[Introduction Hi all, this article explains how to load the contents from a text file using jQuery and style the contents. Background I wanted to load same contents in various pages. For example the article links in my blog. The problem here is, I can&#8217;t use a master page since I have not included ASP.Net in my hosting plan and the next problem is I have not included a database also. My blog is entirely based on normal HTML pages. So I thought of entering the href tags in a text file and loading those href tags in the pages [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction<br />
</strong><br />
Hi all, this article explains how to load the contents from a text file using jQuery and style the contents.</p>
<p><strong>Background</strong></p>
<p>I wanted to load same contents in various pages. For example the article links in my blog. The problem here is, I can&#8217;t use a master page since I have not included ASP.Net in my hosting plan and the next problem is I have not included a database also. My blog is entirely based on normal HTML pages. So I thought of entering the href tags in a text file and loading those href tags in the pages accordingly.</p>
<p>That&#8217;s all.</p>
<p><strong>Create a text file</strong></p>
<p>I have put some of my article links in a text file as shown below.</p>
<div class="dp-highlighter">
<ol class="dp-xml" start="1">
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">target</span>=<span class="attribute-value">&#8220;_blank&#8221;</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;compress-xml-string-variables-in-client-side-and-export-in.html&#8221;</span><span class="tag">&gt;</span></li>
<li class="">   Compress XML, String, Variables in Client Side and Export in HTML5 Using jQuery</li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span>myBreak</li>
<li class=""><span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">target</span>=<span class="attribute-value">&#8220;_blank&#8221;</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;Infosys-Interview-Questions-For-DotNet-Professionals.html&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt">   Infosys Interview Questions for Dot Net Professionals</li>
<li class=""><span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span>myBreak</li>
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">target</span>=<span class="attribute-value">&#8220;_blank&#8221;</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;Using-GitHub-Application-in-Windows.html&#8221;</span><span class="tag">&gt;</span></li>
<li class="">   Upload your Source Code to GitHub using GitHub Application in Windows</li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span>myBreak</li>
<li class=""><span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">target</span>=<span class="attribute-value">&#8220;_blank&#8221;</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;dot-net-interview-questions-for-experienced-and-fresher.html&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt">   Interview Questions For Experienced and Beginner .NET Professionals</li>
<li class=""><span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span>myBreak</li>
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">target</span>=<span class="attribute-value">&#8220;_blank&#8221;</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;export-hierarchical-html-multi-level-html-with-styles.html&#8221;</span><span class="tag">&gt;</span></li>
<li class="">   Export Hierarchical (Multi-Level) HTML Table With Styles Using jQuery</li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span>myBreak</li>
<li class=""><span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">target</span>=<span class="attribute-value">&#8220;_blank&#8221;</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;how-to-make-your-website-loads-faster.html&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt">   How to Make Your Website Load Faster</li>
<li class=""><span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span>myBreak</li>
<li class="alt">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</li>
<li class=""><span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">target</span>=<span class="attribute-value">&#8220;_blank&#8221;</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;Convert-CellSet-to-HTML-table-And-From-HTML-To-Json-To-Array.html&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt">   Convert CellSet to HTML Table and From HTML to JSON and to Array</li>
<li class=""><span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span>myBreak</li>
</ol>
</div>
<p>Please note that I have used a separator in each href tag. That is “myBreak”. Please download the attachment, myContents, for more information.</p>
<p><strong>Load a jQuery reference</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;script src=<span class="string">&#8220;jquery-2.1.3.min.js&#8221;</span>&gt;&lt;/script&gt;</li>
</ol>
</div>
<p>You can get this file from the source code attached here.</p>
<p><strong>Write the script </strong></p>
<p>The following is the script block I have written for the requirements.</p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;script type=<span class="string">&#8220;text/javascript&#8221;</span>&gt;</li>
<li>        $(document).ready(<span class="keyword">function</span> () {</li>
<li class="alt">            $.get(<span class="string">&#8216;myContents.txt&#8217;</span>, <span class="keyword">function</span> (data) {</li>
<li>                <span class="keyword">var</span> myHrefCollection = <span class="string">&#8216;&lt;ul&gt;&#8217;</span>;</li>
<li class="alt">                <span class="keyword">var</span> myData = data.split(<span class="string">&#8220;myBreak&#8221;</span>);</li>
<li>                <span class="keyword">for</span> (i = 0; i &lt; myData.length; i++) {</li>
<li class="alt">                    <span class="keyword">if</span> (myData[i] != <span class="keyword">null</span> || myData[i] != undefined)</li>
<li>                        myHrefCollection += <span class="string">&#8216;&lt;li&gt;&#8217;</span> + myData[i] + <span class="string">&#8216;&lt;/li&gt;&#8217;</span>;</li>
<li class="alt">                }</li>
<li>                myHrefCollection += <span class="string">&#8216;&lt;/ul&gt;&#8217;</span>;</li>
<li class="alt">                $(<span class="string">&#8216;#container&#8217;</span>).html(myHrefCollection);</li>
<li>            });</li>
<li class="alt">        });</li>
<li>    &lt;/script&gt;</li>
</ol>
</div>
<p>In the preceding script we are taking the contents from the text file using the get method of jQuery. And once the data is retrieved, we are splitting the data. To do that we are using a separator (myBreak) in our content.</p>
<p><strong>Add CSS</strong></p>
<p>Add the following CSS styles.</p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;style&gt;</li>
<li>        a {</li>
<li class="alt">            display: block;</li>
<li>            margin: 0;</li>
<li class="alt">            padding: 5px 10px 5px 20px;</li>
<li>            color: #777777;</li>
<li class="alt">            text-decoration: none;</li>
<li>            border-bottom: 1px dotted #666666;</li>
<li class="alt">            background: url(<span class="string">&#8220;orange_file.gif&#8221;</span>) no-repeat 10px center #F9F9F9;</li>
<li>            outline: none;</li>
<li class="alt">        }</li>
<li>        ul {</li>
<li class="alt">            margin: 0;</li>
<li>            padding: 0;</li>
<li class="alt">            list-style: none;</li>
<li>        }</li>
<li class="alt">        li {</li>
<li>            margin: 0 0 3px 0;</li>
<li class="alt">            padding: 0;</li>
<li>            display: list-item;</li>
<li class="alt">            text-align: -webkit-match-parent;</li>
<li>        }</li>
<li class="alt"><span class="preprocessor">        #container {</span></li>
<li>            display: block;</li>
<li class="alt">            width: 700px;</li>
<li>            padding: 25px;</li>
<li class="alt">            background-color: #F9F9F9;</li>
<li>            margin-bottom: 30px;</li>
<li class="alt">        }</li>
<li>    &lt;/style&gt;</li>
</ol>
</div>
<p><strong>Output</strong><br />
<img fetchpriority="high" decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/load-contents-from-notepad-using-jquery/Images/Picture2.png" alt="" width="600" height="523" /><br />
<strong>Conclusion</strong></p>
<p>Please download the source code for more details. I hope you liked this article. Now please share your thoughts and suggestions. It matters a lot.</p>
<p>Kindest Regards,</p>
<p>Sibeesh Venu</p>
<p><a href="http://www.c-sharpcorner.com/UploadFile/65794e/load-contents-from-notepad-using-jquery/www.sibeeshpassion.com" rel="nofollow">www.sibeeshpassion.com</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/load-contents-from-text-file-using-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
