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:
- $(".product img").draggable({
-
- containment: 'document',
- opacity: 0.6,
- revert: 'invalid',
- helper: 'clone',
- zIndex: 100
-
- });
- $("div.content.drop-here").droppable({
-
- drop:
- function(e, ui)
- {
- var param = $(ui.draggable).attr('src');
-
- if($.browser.msie && $.browser.version=='6.0')
- {
- param = $(ui.draggable).attr('style').match(/src=\"([^\"]+)\"/);
- param = param[1];
- }
- addlist(param);
- }
-
- });
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:
- var grbData = $.ajax({
- type : "GET",
- url : "getRow.php",
- dataType: 'html',
- success: function (html) {
- $(".drag-desired").html(html);
- },
- error: function (xhr) {
- $('#errorDisplay').html('Error: '+ xhr.status +'' +xhr.statusText);
- }
- });
I just don't know how to do that.