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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:46:14+00:00 2026-05-18T05:46:14+00:00

I need to make a json request with the url structure like : site.com/page?id=123

  • 0

I need to make a json request with the url structure like : site.com/page?id=123

How do I pass the variable through the request and then return the results to the page?

    <input type='text' id='theInput'>
    <input onclick='getIt(); return false;'  />
    <div id="results"></div>
    <script>
        function getIt(){
        var x = ($j('#theInput').val() );
        $j.getJSON("http://site.com/page?id=", 
          {
        //how do i append x to request?
          },
        );
        }
    </script>
  • 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-18T05:46:15+00:00Added an answer on May 18, 2026 at 5:46 am

    Try like this:

    var id = $j('#theInput').val();
    $j.getJSON('http://site.com/page', { id: id }, function(result) {
        // success
    });
    

    Also I would recommend you using unobtrusive javascript:

    <input type="text" id="theInput" />
    <input type="button" id="btn" value="Click me" />
    <div id="results"></div>
    

    And then in a separate javascript file:

    $(function() {
        $('#btn').click(function() {
            var id = $j('#theInput').val();
            $j.getJSON('http://site.com/page', { id: id }, function(result) {
                // manipulate the results
            });
            return false;
        });
    });
    

    Also you should make sure that you respect the same origin policy or your AJAX request might not work. Verify that http://site.com/page is the same domain as the one that hosts the page sending the AJAX request. If this is not the case you could configure your server to send a JSONP response.

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

Sidebar

Related Questions

I need to make a piece of C# code interact through COM with all
I need to make a request to an API which returns json formatted data.
I need to make a jsonp POST request with the content type 'application/json'. I
I need to make a synchronous request to the last.fm API, but when I
So I need to make a a cross domain request where the response is
I need to make an Ajax request, but its response may vary and it's
I am trying to load a html page through UIWebview.I need to disable all
I have this situation where I need to make a URL with a string
I have a crystal report file I need make a tiny edit in. It
I need to make a WebCast presentation soon and need to do some whiteboarding

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.