Skip to content

Instantly share code, notes, and snippets.

@Opus1no2
Created November 9, 2012 21:10
Show Gist options
  • Save Opus1no2/4048263 to your computer and use it in GitHub Desktop.
Save Opus1no2/4048263 to your computer and use it in GitHub Desktop.
Simple url parser
<!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