Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7877145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:17:20+00:00 2026-06-03T03:17:20+00:00

i have been looking around to try and work out how to pass 2

  • 0

i have been looking around to try and work out how to pass 2 variables arcoss the page thru ajax i have at this moment a page where a check box dynamailcy saves its value to the database on the click of it but i need it to be able to only edit rows with a certian id at thi moment i have gotten this far but i am stuck. any help would be greatly appricated

$(function()
    {

    $("input[type='checkbox']").on('click', function(){
    var chkName = $(this).attr('checked');
    if($(this).is(":checked")) {
    var checkVal = $(':checkbox[checked='+chkName+']').attr('value');
    }
    else{
    var checkVal =$("#frm input:checkbox").attr("id");  
    }
    var userid = $(':checkbox[checked='+chkName+']').attr('name');
            $.ajax({
            type: "GET",
            url: 'request.php?uname=' + checkVal '&id'= + userid ,// this is where i cant send the &id varible across but i can send the checkVal 

            success: function(data) {

        if(data == 1){//Succues 
             alert('Data was saved in db!');
          }
        if(data == 0){//Faliure 
             alert('Data was NOT saved in db!');
          }
            }
    });
  });

  });

</script>
</head><body>
    <div class="content">
    <table border="0.02px" class="mytable">
    <thead>
    <th><strong>Paid</strong></th>
    <th><strong>Repaired</strong></th>
    <th><strong>Returned</strong></th>
    </thead>
    <tr>
            <form id="frm" name="frm">
                <td><input type="checkbox"  value="Paid"          id="Waiting on Payment"  name="29" /></td>
                <td><input type="checkbox"  value="Repaired"      id="Waiting on Repairs"  name="uname" /></td>
                <td><input type="checkbox"  value="With Student"  id="Awaiting Pickup"     name="uname" /></td>
            </form>
    </tr>
    </table>    
    </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:17:21+00:00Added an answer on June 3, 2026 at 3:17 am

    Below line in your code is incorrect:

    url: 'request.php?uname=' + checkVal '&id'= + userid ,
    

    Should be:

    url: 'request.php?uname=' + checkVal +'&id=' + userid,
    

    Also consider using var isChecked = $(this).prop('checked'); to get the checked status of checkbox.

    In line var chkName = $(this).attr('checked');, value of chkName would be ‘undefined‘, while the checkbox is unchecked and so as the line
    var userid = $(':checkbox[checked='+chkName+']').attr('name');.

    If I understand your code correctly, then you may try this:

    $("input[type='checkbox']").on('click', function() {
    
        var $this = $(this);
        var isChecked = $this.prop('checked');
    
        var checkVal = isChecked ? $this.attr('value') : $this.attr("id");
    
        var userid = $this.attr('name');
    
        $.ajax({
            type: "GET",
    
            //url: 'request.php?uname=' + checkVal '&id' = +userid,
            url: 'request.php?uname=' + checkVal +'&id=' + userid,
    
            // this is where i cant send the &id varible across but i can send the checkVal
            success: function(data) {
    
                if (data == 1) { //Succues
                    alert('Data was saved in db!');
                }
                if (data == 0) { //Faliure
                    alert('Data was NOT saved in db!');
                }
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking around the web for this but cannot really find a
I have been looking around online to try to find a complete solution but
I have been trying to work out the bug on this but can't seem
I have been looking around for this but couldn't find an answer anywhere, so
I have been looking around for solutions, and tried to implement what is often
I have been looking around ocn Google and Stackoverflow but haven't found what I
I have been looking around on the web and found some articles about the
I have been looking around and even found a couple of related answers and
I have been looking around for awhile now and I can't seem to find
So I am a little confused, I have been looking around trying to determine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.