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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:11:34+00:00 2026-05-31T16:11:34+00:00

With jquery, I’m trying to make it so when the user clicks on a

  • 0

With jquery, I’m trying to make it so when the user clicks on a button it runs some code on another page and returns a number, which is placed into #result.

This is probably wrong, but am I on the right lines?

$("#button").click(function(){
    $.post("getdata.php?get=a", function(data){
    $('#result').html(data);
    });
  • 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-31T16:11:35+00:00Added an answer on May 31, 2026 at 4:11 pm

    You’re very close

    http://api.jquery.com/jQuery.post/

    Your data is what you send to the server, in other words, get rid of the ?get=a and instead you’d put it like this

    $("#button").click(function(){
        $.post("getdata.php",
        {get: a},
        function(data){
            $('#result').html(data);
        });
    });
    

    You see, first you put your url, then you put what you’re sending to the server, then you put the callback function. For clearer code, sometimes it’s written like this

    $("#button").click(function(){
        $.post(
            url: "getdata.php",
            data: {get: a},
            success: function(data){
                $('#result').html(data);
            });
    });
    

    EDIT: for your purposes, here it is on JSfiddle http://jsfiddle.net/U5XHt/ note that the url doesn’t exist though.

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

Sidebar

Related Questions

Jquery and other JS frameworks got many lazy image loading plugins, code-blocks. Which basically
jQuery and JavaScript in general are new ground for me. What are some good
I am trying to understand how to use SyndicationItem to display feed which is
jQuery mobile button renders gibberish for filter button after clicking on pagination. Click event
jQuery mobile 1.0 I change the content of the page, to put it simple:
jquery update breaks when jquery, itself update input value!! i have some input boxes
JQuery's sortable has an option to revert the item that the user drags back
Jquery has utility a function called ' extend ' which can be used to
Jquery question So i got if condition, in this condition I make div visible
jQuery(document).ready(function ($) { $('body').keypress(function (e) { alert(e.which); }); }); This will pop up an

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.