1

I have a multiselect drop down, on selecting multiple items from it, i need to pass the value of this multiselect into an ajax file, and create divisions dynamically and load the data retreived from the ajax files into these dynamic divisions.

var itemvalues= [];

$('#MultiSelectItemID :selected').each(function(i, selected) {

itemvalues[i] = $(selected).val();

                });


$('#itemContent').html(LoadHTML);       
        $('#itemDetailsContainer').fadeIn('',function(){                    
        $('#itemContent').load('ajax_calls/item_details.php?ItemID='+$('select[name=MultiSelectItemID]').val() || [], 
        function(){
                    $(this).show('highlight');      



                    });     });

Now , i want to loop through each value in the itemvalues[] array and pass it to my php file and get the data and load it into a new division.

Please help.

1 Answer 1

1

Will this do the job? (Note I 've changed "MultiSelectItemID" to simply "ItemID" and serialize()d it.)

http://jsfiddle.net/svzsY/8/

    var itemvalues = [];
    $('#itemContent').html(LoadHTML);
    $('#itemDetailsContainer').fadeIn('', function() {
        $('#itemContent').load('ajax_calls/item_details.php', ($('select[name=ItemID]').serialize() || []), function() {
            $(this).show('highlight');
        });
    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.