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

  • Home
  • SEARCH
  • 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 9199887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:38:27+00:00 2026-06-17T22:38:27+00:00

When I submit the ajax, I need to post three data parameters to process.conversation.php

  • 0

When I submit the ajax, I need to post three data parameters to process.conversation.php: method, s_state, and c_id. s_state and c_id are found in those two input values. Both variables are correctly being set. I use alert(s_state) and alert(c_id), and they were both as I expected.

Everything works perfectly fine, except my c_id is not getting posted. If I change, in the ajax, c_id: '1', the 1 will be posted as I would expect; however, when I use the variable c_id assigned to 1, it does not get posted (or at least does not get posted with the value I was alerted with…I’m not sure which.) I do, however, get the success toggleClass in all instances.

Note: s_state works exactly as I would expect, as does method. If s_state = '1', it gets posted with that variable. So, I have no idea why c_id is not working.

Any and all ideas are fully welcome.

What might be going wrong?

jQuery/ajax:

$(".__conversation_s").click(function() {

var $thisS = $(this);
var s_state = $thisS.find("input[name='s_state']").val();
var c_id = $thisS.find("input[name='c_id']").val();

jQuery.ajax({
   type: 'POST',
   url: "./process.conversation.php",
   data: {
       method: 'star_toggle', 
       s_state: 's_state',
       c_id: 'c_id'     
   },
   cache: True,
   success: function() {
       $thisS.toggleClass("__starred");
   }
});
});

and some html:

<div class='__conversation_s'>
    <input type='hidden' name='s_state' value="<?php echo $s_important; ?>">
    <input type='hidden' name='c_id' value="<?php echo $c_id; ?>">
</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-17T22:38:28+00:00Added an answer on June 17, 2026 at 10:38 pm

    Syntax is incorrect in your data object. You have quotes around the variable names which means they are not variables but strings that contain the same letters as the variable name.

    data: {
           method: 'star_toggle', 
           s_state: 's_state',
           c_id: 'c_id'  /* will send the string with letters `c` and `_` and `id` to server*/   
       }
    

    Remove quotes from variables:

    data: {
           method: 'star_toggle', 
           s_state: s_state,
           c_id: c_id 
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$('#post_form').submit(function() { $(#ajax_bar_loader).show(); $.ajax({ url: 'add.html', data: $('#post_form').serialize(), dataType: 'json', type: 'post', success: function(
I need to submit some data via ajax. It is not a form, but
$(#submitbutton).button().click(function() { $.ajax({ type: 'POST', url: 'tst/mmm.php', data: { abc: abcdefghijklmnopqrstuvwxyz }, success: function(msg){
Consider a simple form with 2 submit buttons <form method=post> <button type=submit name=command value=cancel>Cancel
I need to have a checkbox which ajax-submits a form. The following code throws
Possible Duplicate: jQuery AJAX submit form I have a form on a page A,
i'm trying to submit my Ajax form using jQuery. However calling the submit() function
Is there a way to stop cakephp ajax submit to stop the submission in
I'm creating a basic form with ajax submit using jquery framework. This is my
I have a page with multiple forms that I submit via Ajax POSTs serially.

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.