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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:38:08+00:00 2026-06-06T13:38:08+00:00

I am making a CRUD application in jquery and i have this problem in

  • 0

I am making a CRUD application in jquery and i have this problem in my application.To edit a record i am getting the id of the record successfully.

<a href="#" id="<?php echo $msg_id; ?>"  class="update_btn">Edit</a>

I want to retrieve the id and that works.

$('.update_btn').live("click",function() 
{
var ID = $(this).attr("id");
var dataString = 'msg_id='+ ID;
//alert(dataString);

$.ajax({
type: "POST",
 url: "get-data.php",
 dataType: 'json',
 cache: false,
 success: function(data){
 //getData()
 }
});
return false;
});

However,how can i use the retrieved id to

//get-data.php
include('db.php');
if($_POST['msg_id'])
{
$id=$_POST['msg_id'];
$id = mysql_escape_String($id);
$sql_in= mysql_query("SELECT msg FROM messages where msg_id='$id'");
$r=mysql_fetch_array($sql_in);
$msg=$r['msg'];
echo json_encode($msg);
}

return the data from the select query.Is this possible?.

  • 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-06T13:38:09+00:00Added an answer on June 6, 2026 at 1:38 pm

    You need to use data option in your ajax request to send your id first:

    $.ajax({
       type: "POST",
       url: "get-data.php",
       dataType: 'json',
       data: dataString , // <--------- added this line
       cache: false,
       success: function(data){
         //getData()
     }
    });
    

    Now you will be able to get it in PHP with what you are doing eg $_POST['msg_id']

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

Sidebar

Related Questions

Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
I'm making a simple CRUD app with ASP MVC and I want to have
making an infinite loop in javascript, and jQuery... this is my current code: $(#bg2).css({opacity:
Making websites that appear correctly in IE is a big problem. Is there any
When making relations between tables (in mysql), I have encountered a naming dilemma. For
Making a mobile friendly site, I have a single field and a submit button.
I have a typical CRUD app, I would like to add a link next
Making a piano/keyboard application and trying to figure out the best way to set
making a multi-language site with codeginiter. I have created two folders. One for french
I am having difficulty making any sense of this! What is he trying to

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.