Postingan lainnya
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
jquery get url
cara mendapatkan urlnya gimana dengan jquery misal url saya : http://localhost/hrfastnan/index.php?act=attendance&tipeUrl=hisabsbwh ingin menampilkan alert hisabsbwh nya aja gimana?
0
2 Jawaban:
misal url : http://localhost/forumsk/index.php#tab2?foo=789
<html>
<head>
<title>URL</title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
$(location).attr('host'); // return : localhost / www.example.com:8082
$(location).attr('hostname'); // return : localhost / www.example.com
$(location).attr('port'); // return : 8080
$(location).attr('protocol'); // return : http:
$(location).attr('pathname'); // return : /forumsk/index.php
$(location).attr('href'); // return : http://localhost/forumsk/index.php#tab2
$(location).attr('hash'); // return : #tab2
$(location).attr('search'); // return : ?foo=789
alert($(location).attr('host'));
</script>
</body>
</html>
0
coba pake php dlu aja di tag html nya contoh
0