Saving tab content using javascript
I am working on a website where I have to save a tab which has RSS feeds
in it and retrieve it later when the user returns( I am using Boostrap).
The html code for tab is
<!-- RSS FEED jquery plugin -->
<script src="jquery.zrssfeed.min.js"></script>
<!--Adding tab Header-->
<ul id="pageTab" class="nav nav-tabs">
<li class="active"><a href="#page1"
data-toggle="tab">Welcome</a></li>
</ul>
<!--Adding tab Content-->
<div id="pageTabContent" class="tab-content">
<div class="tab-pane active" id="page1">
<p>--- RSS FEED--- </p>
<script type="text/javascript">
$(document).ready(function () {
$('#page1').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews', {
limit: 5
});
});
</script>
</div>
</div>
I want to save the layout and the url so I can retrieve it back. I tried
function saveLayout()
{
//Save content to database
$.ajax({
type: "POST",
url: "saveLayout.php",
data: {
tab_header:$('#pageTab').html(),
tab_content:$('#pageTabContent').html()
},
success: function(data1)
{
console.log("success");
console.log(data1);
}
});
}
But this doesn't work, the javascript for RSS feed fills the div with the
fetched html and I dont think its wise to store all the content because if
the user logs out and logs in again, this will fetch him the old RSS feeds
from the database. How to solve this problem?
No comments:
Post a Comment