autoretrieve title and description after entering new url

This commit is contained in:
Arthur Schiwon 2011-08-23 16:30:29 +02:00
parent 672515c23f
commit 847347b58a
1 changed files with 14 additions and 0 deletions

View File

@ -9,6 +9,8 @@ $(document).ready(function() {
$('#bookmark_add_submit').click(addBookmark);
$(window).scroll(updateOnBottom);
$('#bookmark_add_url').focusout(getMetadata);
$('.bookmarks_list').empty();
getBookmarks();
});
@ -36,6 +38,18 @@ function getBookmarks() {
});
}
function getMetadata() {
var url = encodeEntities($('#bookmark_add_url').val())
$.ajax({
url: 'ajax/getMeta.php',
data: 'url=' + encodeURI(url),
success: function(pageinfo){
$('#bookmark_add_description').val(pageinfo.data.description);
$('#bookmark_add_title').val(pageinfo.data.title);
}
});
}
function addBookmark(event) {
var url = encodeEntities($('#bookmark_add_url').val())
var title = encodeEntities($('#bookmark_add_title').val())