mardi 21 juillet 2015

jquery checked checkbox for multiple load()

I need to load external file with checkbox

<div id="checkboxes">
            <form class="form_categoria">
                <input name="primo" type="checkbox" value="1">primo<br>
                <input name="secondo" type="checkbox" value="2">secondo<br>
                <input name="terzo" type="checkbox" value="3">terzo     
            </form>
        </div>
<form class="elenco">
        N: <div id="risultato_lista"></div>
    </form>


$(document).ready(function(){
        $('input[type="checkbox"]').change(function() {
            //var checkbox_value = "";
            $('input[type=checkbox]').each(function () {
            var ischecked = $(this).is(":checked");
                if (ischecked`enter code here`) {
                    checkbox_value = $(this).val();
                    $('#risultato_lista').load(checkbox_value + '.php');
                }
            });
        //alert(checkbox_value);
        });
    });

But the code load only the last checked checkbox. I need to load all external .php files selected by the checkboxes. How to solve it?




Aucun commentaire:

Enregistrer un commentaire