jQuery.get Help

jQuery.get Help

I have the following Javascript code and I can't seem to get it to work properly...

function DeleteSelectedBookmarks() {
   bookmarksToBeDeleted = array();

   if (document.deletebookmark.elements.length == 1) {
      if (document.deletebookmark.deletebookmark.checked) array_push(bookmarksToBeDeleted, document.deletebookmark.deletebookmark.value);
   }
   else {
      checkboxes = document.deletebookmark.deletebookmark;
           for (i = 0; i < checkboxes.length; i++) {
              if (checkboxes[i].checked) array_push(bookmarksToBeDeleted, checkboxes[i].value);
           }
   }
   
   if (count(bookmarksToBeDeleted) == 0) {
      alert("You haven't selected any bookmarks to delete.");
      return;
   }
   
   $.get("bookmarks.php", {delete: serialize(bookmarksToBeDeleted)},
      function (result, bookmarksToBeDeleted) {
         if (result == "done") {
            if (count(bookmarksToBeDeleted) == 1) alert("Bookmark Deleted.");
            else alert("Bookmarks Deleted.");
         }
         
         RefreshBookmarks();
      }
   );
}


What it is supposes to do is gather the amount of bookmarks that need to be deleted and then send the command to the server to do so. The server then gives a message back (if it is successfully the result is "done") and depending upon how many bookmarks it deleted it gives a different result, ie. singular vs. plural.

How do I do this?