How to pass the checkbox checked id to sql query in where clause?


#1
            function performAction(){
            var id = $('input.jsCheckBox:checked', $('#jsFrmId')).val();
        
            alert(id);
            if(id  == undefined){
                alert('Select atleast one request!.');
                return false;
            }
            //load the form in colorbox
            $.colorbox({
                inline:true, 
                iframe: false,
                href: '#jsCommentsBox',
                initialWidth: '500px',
                initialHeight: '220px',
                height: '220px', 
                width: '500px', 
                transition: 'fade', 
                opacity: 0.4 });                
        }

#2

http://api.jquery.com/jquery.ajax/


#3

I have done it but the id isn’t getting passed in sql query, even if i try to echo its giving undefined id.


#4
$.ajax({
                type: 'POST',
                data: {'id':id},
                success: function(data) {
                    console.log("++++++++++++++++++++++++++++++++");
                     console.log(id);
                    console.log("++++++++++++++++++++++++++++++++");
                }
            });

#5

In your last code sample with the $.ajax I do not see where the id variable is being created. Post the full code.


#6
            function performAction(){
            var id = $('input.jsCheckBox:checked', $('#jsFrmId')).val(); 
            if(id  == undefined){
                alert('Select atleast one request!.');
                return false;
            }
            alert(bta_id);
            $.ajax({
                url: 'myphpfile.php',
                type: 'POST',
                data: {id:id},
                success: function(data) {
                    console.log("++++++++++++++++++++++++++++++++");
                    console.log(id);
                    console.log("++++++++++++++++++++++++++++++++");
                    
                }
            });
            //load the form in colorbox
            $.colorbox({
                inline:true, 
                iframe: false,
                href: '#jsCommentsBox',
                initialWidth: '500px',
                initialHeight: '220px',
                height: '220px', 
                width: '500px', 
                transition: 'fade', 
                opacity: 0.4 });                
        }

#7

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)