• Log in or sign up for an account here: https://www.sythe.org/login

NEED HELP

ryanboyd

Forum Addict

$25 USD Donor New
Joined
May 28, 2016
Sythe Gold
16
Messages
463
Dragon Claws
Easter 2017
Extreme Homosex
Potamus
Rust Player
NEED HELP
so here is my current code

<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#five_year').dataTable({
"iDisplayLength": 25
});
});
</script>

but i need to some how load a table from another html file so i can just change the file instead of refering to the html code.

Can anyone help me?

for example the html file being called is data.html

thanks
 
NEED HELP
so here is my current code

<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#five_year').dataTable({
"iDisplayLength": 25
});
});
</script>

but i need to some how load a table from another html file so i can just change the file instead of refering to the html code.

Can anyone help me?

for example the html file being called is data.html

thanks

Hey ryanboyd,
Hopefully I can help you out.

First off, type="text/javascript" charset="utf-8" isn't needed, js is implied by script.
Secondly, you set the charset in <head>, (<meta charset="UTF-8" />)

Anyways, in response to your actual question, you'll need to load it dynamically with AJAX
$.get() jQuery
you'd also be better off just using a json file since you can parse that directly into some json structure in JS, as it is JS Object Notation and then use dataTable with that.

Hopefully this was helpful to you,
If you need more assistance you're welcome to PM me.
 
Last edited:
NEED HELP
Well technically all you need to do is build an html table of with all your data. Then initialize the javascript by embedding it in the html file or including it through a js file. If you include it through a js file you do not have to have the <script></script> tags.
 
NEED HELP
Hey ryanboyd,
Hopefully I can help you out.

First off, type="text/javascript" charset="utf-8" isn't needed, js is implied by script.
Secondly, you set the charset in <head>, (<meta charset="UTF-8" />)

Anyways, in response to your actual question, you'll need to load it dynamically with AJAX
$.get() jQuery
you'd also be better off just using a json file since you can parse that directly into some json structure in JS, as it is JS Object Notation and then use dataTable with that.

Hopefully this was helpful to you,
If you need more assistance you're welcome to PM me.


Shouldn't need to use ajax if its static data in the same file system.. just navigate the file system.

@ryanboyd if you can use php why don't you just completely build your table (assuming its static) in your data file and then include it? This is common for static data like headers and footers. If your static data is only 25 rows personally I would just have it in your html to begin with instead of fetching it.

Code:
<?php include 'data.php';?>
 
Runescape Gamblingrunescape gambling
Back
Top