Getting A Post ID VIA AJax

Discussion in 'Javascript' started by Spudster, Jul 16, 2014.

  1. Spudster

    Spudster

    Joined:
    Jul 16, 2014
    Messages:
    1
    Likes Received:
    0
    Hello.
    I apologize that I cannot provide the source since I'm on my tab right now but I try to explain as clear as possible, What I am trying to archive is get an id of a post in the database so say when a user comments then hits enter that will then get the post ID From the groups_posts table to insert the id in the groups_comments table since each comments needs the id of the post it is assigned to, I cannot seem to archive this as Ajax JQUERY won't get the id of the post where as pure php worked fine :/

    The question is when making a group feature like FB what's the best way to get an id of the post that the user has commented on so the comment knows what post to display under. While using JQUERY


    Hoe this makes sense.

    Spudster
     
    Spudster, Jul 16, 2014
    #1
    1. Advertisements

  2. Spudster

    osforum4

    Joined:
    Jul 7, 2017
    Messages:
    4
    Likes Received:
    0
    Location:
    Germany
    You can try AJAX once.
    You need to call PHP file with ajax request so it will insert data without reloading your page.

    var values = $(this).serialize();

    $.ajax({
    url: "your.php",
    type: "post",
    data: values , //pass id
    success: function (response) {
    // you will get a response from your PHP page (what you echo or print)

    },
    error: function(jqXHR, textStatus, errorThrown) {
    console.log(textStatus, errorThrown);
    }
    });

    If you can provide snippets of source code then I can help liitle bit more.
     
    osforum4, Jul 7, 2017
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Vishal
    Replies:
    1
    Views:
    928
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
  2. =?Utf-8?B?RGF2ZSBCcm93bg==?=

    HttpWebRequest POST result is not the same as POST via ServerXMLHT

    =?Utf-8?B?RGF2ZSBCcm93bg==?=, Nov 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,400
    Joerg Jooss
    Nov 10, 2005
  3. minnie
    Replies:
    1
    Views:
    1,171
    Andrew Thompson
    Dec 13, 2006
  4. J. Muenchbourg
    Replies:
    0
    Views:
    632
    J. Muenchbourg
    Aug 6, 2003
  5. Moh

    I need a VHDL code

    Moh, Jun 8, 2016, in forum: VHDL
    Replies:
    0
    Views:
    670
  6. ivan gagula

    VHDL sequence of a machine

    ivan gagula, Jun 22, 2016, in forum: Introductions
    Replies:
    0
    Views:
    495
    ivan gagula
    Jun 22, 2016
  7. alxcam8
    Replies:
    0
    Views:
    664
    alxcam8
    Jun 29, 2016
  8. Amy21
    Replies:
    0
    Views:
    449
    Amy21
    Jan 20, 2017
Loading...