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 898731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:05:43+00:00 2026-05-15T15:05:43+00:00

I have an AJAX call in my jQuery/PHP app. It needs to send some

  • 0

I have an AJAX call in my jQuery/PHP app. It needs to send some data to a PHP script to process (I have this part working fine).

My jQuery variable:

var form_data = {
   urltitle: '<?php echo $urltitle; ?>',
   subscribe: $('#subscribe').val(),
   comment: $('#commentbox').val()
};

This works fine, the PHP script reads the values of all the variables – except for the ‘subscribe’ variable. Subscribe is a checkbox, like so:

<input type="checkbox" name="subscribe" checked="checked" value="subscribe" id="subscribe"/> 

How can I pass the ‘value’ of the checkbox to my PHP script? I have a non-AJAX version of this script too, which is almost identical, except on the PHP side I use:

if (isset($_POST['subscribe'])) { /* do something */ }

And that works fine…

Thanks!

Jack

  • 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-05-15T15:05:44+00:00Added an answer on May 15, 2026 at 3:05 pm

    When you say value do you mean subscribe or do you just want to know if the checkbox has been checked or not.

    If you just want to know if it has been checked then you can do $('#subscribe:checked').val() and if it is null then you know it is not checked and if it is not then you should have the value in your case subscribe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running ASP.NET MVC Beta. I have an AJAX call running through jQuery
Let's say I have the following jQuery AJAX call: $.ajax({ type: POST, url: MyUrl,
I have this code that performs an ajax call and loads the results into
I have coded some JavaScript to perform an ajax call in an asp.net application.
here is the case. with jquery ajax call i have added a new link
I have a jQuery AJAX data grid that loads a list of elements from
On my website I use a long polling jquery ajax function. This ajax call
I have an ajax request that requests a php script that connects to my
I have this ajax jquery code: var form = document.getElementById('frm'); var data_string = form.serialize();
I have a html page that after ajax call show a lot of data

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.