When dragged and on mouseup/mouseleave in the document I want to call my Ajax request

Posted by Sappy on Stack Overflow See other posts from Stack Overflow or by Sappy
Published on 2012-09-03T14:00:36Z Indexed on 2012/09/03 15:38 UTC
Read the original article Hit count: 125

Filed under:
|
|

For slider range - when dragged and on mouseup/mouseleave in the document I want to call my Ajax request.

Explained: When I mousedown to slide my slider I want to say isDown = "true" But it doesn't works.

Can anyone please help me with this and let me know how do I achieve this.

// Default 
isDown = false

$("#slider-range").find('a').mousedown(function(){
    isDown=true;
    console.log(isDown); // It works here!
});

console.log(isDown); // It doesn't works here

if(isDown)
{
    $(document).onmouseup(function() {
        return setAjaxRequest();
        isDown = false;
    });
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery