views:

41

answers:

1

I have created a page that uses ajax calls to load product images. The jquery code for drag, drop and clone would not work when in the index.php page so I moved it to the page that gets called to request the products as each product has drag, drop code created for it.

Works fine in FF, even IE but not in Safari or Chrome. Below is the jquery code in load_products.php that gets created when the ajax call is made to load the products.

http://tandyleatherfactory.net/

Anyone have any idea why wouldn't work in Safari?

$(function() {$("#concho_4_2").draggable({
    helper: 'clone',
    cursor: 'pointer',
    zIndex: '1001',
    stop: function(event, ui) 
    {
        offsetElement = $(ui.helper).offset();
        offNewContainer = $('#belts').offset();

        var dataId = $(ui.helper).attr('id');

        ajaxRequest('http://tandyleatherfactory.net/includes/ahah/add_product.php', 'product=4', '#conchos');

        var randomnumber = Math.floor(Math.random()*1000000);
        var newId = 'concho_4_2_'+randomnumber;

        $(ui.helper).clone(true).removeAttr('id').attr('id',newId).css("left", offsetElement.left-offNewContainer.left-10).css("top", offsetElement.top-offNewContainer.top-10).appendTo('#belts');                     
        $('#'+newId).draggable();                
    }
});
A: 

Found the answer, the loaded ajax page had tags wrapping the script tag, removed the tags, presto, works in IE, FF, Safari, Chrome and Opera.

Thanks for your suggestions.

jbatson