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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:20:31+00:00 2026-06-12T11:20:31+00:00

I would like to send some data by using jquery ajax function to my

  • 0

I would like to send some data by using jquery ajax function to my PHP file.

I have created such function:

function ajax_call (url, select, select_name)
{

    $(select).change(function () {
          $(".result").fadeIn(400).html('<img src="ajax-loader.gif"/>');            
          var select_value = $(this).val();

            $.ajax({        
              type: 'POST', 
              url: url, 
              data: { select_name : select_value }, 
                  success: function(data){  
                      $(".result").html(data); 
                  } 
              });
    });
}

I call it:

ajax_call ('url path to my PHP file', '#my_select_div', 'my_data_name');

I have problem with this part:

data: { select_name : select_value }

I would like to get:

$_POST['my_data_name']

but I’m getting:

$_POST['select_name']

Any ideas?

Thanks for your answers.

  • 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-12T11:20:33+00:00Added an answer on June 12, 2026 at 11:20 am

    When using object literal syntax, the key can be a string or an identifier. The identifier represents the key name, not a variable. You have to assign the key/value after creating the object if you want to use variable key names.

    var data = {};
    data[select_name] = select_value;
                $.ajax({        
                  type: 'POST', 
                  url: url, 
                  data: data
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using to a jQuery post method to send some data to a
I would like to send a lot of data through ajax request to my
I am using some AJAX like this: xmlhttp=new XMLHttpRequest(); xmlhttp.open(GET,http://example.com,false); xmlhttp.send(); data = xmlhttp.responseXML;
I have completed my program and would like to send that program in its
I'm using a Rails application and would like to send/receive text messages through my
I have a window which is hidden and I would like to send a
I would like to expose some data to client applications via HTTP. For example,
Using PHP , I would like to make a while loop that reads a
I would like my android app to be able to send some information to
Since jQuery ajax ist not working for CORS/IE, I'm using XDomainRequest to retreive 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.