Scripts
GET met javascript
Het klinkt raar, ik dacht eerst dat het alleen in PHP kon, maar nee dus. Met wat javascript heb je het zo voor elkaar. je kan het zo gebruiken: $_GET['hoi'] die hoi is de naam en de functie haalt de waarde er van op
index.php
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Javascript 2</title>
<script src="js/get.function.js"></script>
</head>
<body>
<script type="text/javascript">
document.write($_GET['hoi']);
</script>
</body>
</html>
[/code]
get.function.js
[code]
(function () {
$_GET = {};
(location.href || '').replace(/[?&]([^=#]+)(?:=([^?&#]+))?/g, function (match, name, val) {
$_GET[name] = decodeURIComponent(val) || '';
});
}());
[/code]
Reacties
0