Created
November 9, 2012 21:10
-
-
Save Opus1no2/4048263 to your computer and use it in GitHub Desktop.
Simple url parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<center> | |
<form> | |
<textarea id="url" rows="10" cols="60"></textarea> | |
</form> | |
</center> | |
<div id="main"</div> | |
<script> | |
$('#url').bind('input', function() { | |
$('#main').empty(); | |
query = $(this).val().split(/[?&]/); | |
for (i = 0; i < query.length; i++) { | |
$('#main').append('<ul>' + decodeURIComponent(query[i]) + '</ul>'); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment