How to wrap elements from an external JS file into a function then call that function?

How to wrap elements from an external JS file into a function then call that function?

Hello,

I was wondering how I can accomplish wrapping relevant parts of a script into a function then call that function within a success area on another page.

This is what I have so far:

Script.js page - This page is longer but this is the relevant part that I would like to wrap:

  1. $(".product img").draggable({
  2. containment: 'document',
  3. opacity: 0.6,
  4. revert: 'invalid',
  5. helper: 'clone',
  6. zIndex: 100
  7. });

  8. $("div.content.drop-here").droppable({
  9. drop:
  10. function(e, ui)
  11. {
  12. var param = $(ui.draggable).attr('src');
  13. if($.browser.msie && $.browser.version=='6.0')
  14. {
  15. param = $(ui.draggable).attr('style').match(/src=\"([^\"]+)\"/);
  16. param = param[1];
  17. }

  18. addlist(param);
  19. }
  20. });
 
I would like to take this relevant part of the script and call the function that I create within the success portion of this code:

  1. var grbData = $.ajax({
  2. type : "GET",
  3. url : "getRow.php",
  4. dataType: 'html',
  5. success: function (html) {
  6. $(".drag-desired").html(html);
  7. },
  8. error: function (xhr) {
  9. $('#errorDisplay').html('Error: '+ xhr.status +'' +xhr.statusText);
  10. }
  11. });


I just don't know how to do that.