When a user enters a valid URL in a form that I have, I'm using embedly to fetch the thumbnail of the URL (if one exists). I'm considering two ways of doing this right now.
Option 1. On blur event of the URL field, do a URL validation, if it passes validation, then use embedly behind the scenes to ajaxily return the thumbnail URL. If it returns one, then stick it back in the form in a hidden input field.
Option 2. When they POST the form, then handle it.
Option 3. ??? is there a better way?
Both ways will be done on the server using node.js, but am wondering what the best approach here is. My intent is to not have the user waiting on something that might not even be there (i.e. if there is no thumbnail returned).
Option #1 as it allows the user to see what they are posting.
We built a library to handle this case: http://embedly.github.io/jquery-preview/demo/