Quote:
Originally Posted by 2MuchMark
Hi Everyone,
Let me clarify a little.
Both pages are HTML.
My main, fancy html5/css3 sexy page, index.html, would say "Hey! Here's the data! 1&2, 3&4, 5&6. "
The page that actually contains the data would be unformatted nothingness, called "data.html", and would just contain
"1&2", "3&4", "5&6".
Both pages are HTML, and both are on the same domain.
|
I have no idea why you would want to do that But if you are not actually displaying the data page then that is actually a server side call and does not need any javascript but it could be done with ajax as Rowan and Barry have said. But in that case the data page does not have to actually exist as an html page. It can be a data file, it could be a mysql call or any of the other bazillion ways that you could store data on the server.
Where is the data page coming from. If it is displayed in the browser then is it displayed before the fancy page is displayed? In which case, why?
Anyway, here is how you could do that using Ajax (JQuery version):
Ajax version at:
http://madspiders.com/js_test/ajax_page1.htm
Code:
<html>
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<div name=result_div id=result_div></div>
</body>
<script>
$.ajax({url: "data.htm", success: function(result)
{
$("#result_div").html("The data is: " + result);
}
});
</script>
</html>
Data.htm looks like:
.