Posting Variable Data On Form? Display/Run .html
Hello,
I have a forum that I am putting together and it would really be an awesome feature if on the page header I could display some variable data from another source that changes daily. I have some html written and attached below that I can execute in a browser to go to another page and parse out the data I would want to display. I just have very little vbulletin experience and I was wondering what options you guys might come up with to allow me to pull this off. I have even considered looking into the source code for a calendar plug in to see if I might be able to leverage it's approach to doing this. Just to be clear basically I want to display some custom variable txt in the header on all my pages, just think it as a custom quote for the day or a number of stock quotes that change daily. Here is the code that I can run to pull my data note the page reference within the htm is just for an example.
example.html
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$.support.cors = true;
$( document ).ready(function() {
$.ajax(
{
url: 'http://www.forwebexample.com/downone/rrm.php',
type: 'GET',
success: function (result) {
var localContent = $(result).find('#localcontent');
var table = $(localContent).find('table:nth-child(2)');
$(table).find('tr').each(function(){
var row = $(this);
if(row.find('td:eq(0)').html() === 'LOOKUP KEY')
{
var itema = row.find('td:eq(1)').html();
var itemb = row.find('td:eq(2)').html();
var itemc = row.find('td:eq(3)').html();
var itemd = row.find('td:eq(4)').html();
var iteme = row.find('td:eq(5)').html();
var itemf = row.find('td:eq(6)').html();
/*display only*/
var data = 'itema: ' + itema + '<br/> itemb: ' + itemb + '<br/> itemc:' + itemc +
'<br/>itemd: ' + itemd + '<br/>iteme: ' + iteme + '<br/>itemf: ' + itemf;
$('#content').html(data);
/*end display*/
}
});
},
error: function(xhr, status, errorThrown) {
alert(errorThrown);
}
})
});
</script>
</head>
<body>
<!--html element for display-->
<div id='content'></div>
</body>
</html>
|