mardi 8 mars 2016

How to check checkbox is checked or not while price slider event occurs

Here is my code, For price slider:

$("#price-slider").ionRangeSlider({
    min: 130,
    max: 575,

    onChange : function (data) {
    var from_num = data.fromNumber;
    var to_num =data.toNumber;
    $.ajax({
        url: 'hotelresults',
        type: 'POST',
        data: {
        from: from_num,
        to: to_num,
    },
        success: function(data){
            $('.hotel_list').html(data);
        }
    });
    }
});

When this action occurs I have to check whether the checkboxes are checked or not..

And if it's checked then I need to pass that checked checkbox value in this slider Ajax..

And at the same time its vice versa.

i.e: If the checkbox get checked it should pass the price slider value through its Ajax..

And here is my Checkbox click function

$( ".iCheck-helper" ).on( "click", function(){

    var sel = $('.i-check:checked').map(function(_, el) {
        return $(el).val();
    }).get();
// alert(sel);
    var nme = $('.i-check:checked').map(function() {
        return $(this).attr("name");
    }).get();
// alert(nme);
    if(!$(this).is(':checked')){
        $.ajax({
            type: "POST",
            url: "hotelresults",
            data: {
                key : sel,
                name:nme,
            },
            success: function (data) {
                $('.hotel_list').html(data);
            }
        });
    }
}); 

Both these were pass the values through Ajax..

But I need to pass both values as I said already

Some one help me..

Thanks in advance..



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire