Permalink
Browse files

Better way to handle form

  • Loading branch information...
chengyin committed Dec 13, 2012
1 parent 0abebf2 commit 260308578a814886366d5dda903f8f2718ecd5b2
Showing with 2 additions and 12 deletions.
  1. +1 −11 examples/lastfm/app.js
  2. +1 −1 examples/lastfm/index.html
View
@@ -85,15 +85,6 @@
}
}
- function initForm() {
- $('#lastfm-username-form').submit(function() {
- var username = $('#lastfm-username').val();
- lastfm.getUserTopAlbums(username, renderAlbums);
-
- return false;
- });
- }
-
function initTemplate() {
$template = $('#template');
$template.attr('id', '');
@@ -106,12 +97,11 @@
param = param.replace('lastfm=', '');
if (param.length) {
$('#lastfm-username').val(param);
- $('#lastfm-username-form').submit();
+ lastfm.getUserTopAlbums(param, renderAlbums);
}
}
function init() {
- initForm();
initTemplate();
initGet();
}
@@ -6,7 +6,7 @@
</head>
<body>
<form id="lastfm-username-form">
- <input id="lastfm-username" placeholder="Your last.fm Username" />
+ <input id="lastfm-username" name="lastfm" placeholder="Your last.fm Username" />
</form>
<ul id="albums">
</ul>

0 comments on commit 2603085

Please sign in to comment.