Posts Tagged Text Javascript

jQuery reload page

When you load a page using require PHP function, there is time when you want to reload the page in require PHP function again. You can do this by using the require in a div. Then load the page again using jQuery load function.

Here’s the code in the main page:

<html>
<head>
<script type=”text/javascript” src=”jquery.js”></script>
<script type=”text/javascript”>
function  reload()
{
$(“#page”).load(“page.php?value=test”);
}
</script>
</head>
<body>
<div id=”page”>
<?php
require(“page.php”);
?></div>
<br>
<input type=button value=”Click to reload page.php” onclick=”reload();”>
</body>
</html>

And the function in page.php:

<?php
echo “Test value = ” . $_GET['value'];
?>

, , , , , , , , , , , , , ,

No Comments

Google maps code sample

This article is a sample for google maps. You just need to download the code here. In the example, I show Google Headquarters in Google Maps. But before you download, you need to sign up for Google Maps API here and get a key that you will use in the code. From the code that you have download, find the following code:

<script src=”http://maps.google.com/maps?file=api&amp;v=2&amp;key=change-this-to-your-google-api” type=”text/javascript”></script>

and change “change-this-to-your-google-api” to your key. If you have any problem just comment below.

, , , , , , , , , ,

No Comments