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

            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 });                
        }

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

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

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

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

            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 });                
        }

$('some thing', 'another thing') is going to find nothing.

Thank You @thinsoldier. I am able to pass the id now but not able to send it to textfield where I want to display the cost.

Thank you again for you guidance. I was able to do it. @thinsoldier

Sponsor our Newsletter | Privacy Policy | Terms of Service