I've looked all over the web for an answer to this, and all I can really find directed to my actual question is 'ajax' and I'm already using it, but that don't say what in it to use!
Here's my problem: I have HTML code(specifically a table with a form inside of it, but that doesn't matter), and I need the code to depend on a JavaScript variable grabbed from a cookie.
In the beginning of the form, naturally, I'd put my declarations for when the page loads:
<script type="text/javascript">
var login = 0;
var myusername;
var saves = [];
$(document).ready(function() {
if (jQuery.cookie('savedata')) {
savedstats = jQuery.cookie('savedata').split('|');
login = parseInt(savedstats[0]);
myusername = parseInt(savedstats[1);
} else {
login = 0;
}
});
</script>
And I've tried many different ways, but.. No avail.
$('some-element').append('some-html')$('.username').html(myusername)and the HTML would be <span class="username"></span>