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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:11:12+00:00 2026-06-02T00:11:12+00:00

In PHP it’s file.php?id=1 and then $_GET[‘id’] but how is it in jQuery? I

  • 0

In PHP it’s file.php?id=1 and then $_GET['id'] but how is it in jQuery? I have tried following but that didn’t work.

// jQuery
$('id-' + $1).click(function() {
    // more code
}

// HTML
<div id="id-1">text</div>

I’m new to GET in jQuery so please be nice 😛

Thanks in advance.

  • 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-02T00:11:13+00:00Added an answer on June 2, 2026 at 12:11 am

    you should parse location.search:

    var GET = {};
    var params = location.search.substr(1).split("&");
    for (var i=0; i < params.length; i++) {
        var par = params[i].split('=');
        GET[par[0]] = par[1];
    }
    
    $('#id-' + GET["id"]).click(function() {
        // more code
    });
    $(document).ready(function() {
        $('#id-' + GET["id"]).click(function() {
            $('#forecast').show().load('jquery-fetch/fetch-forecast.php?coor=' + GET["coor"] + '&d=' + $(this).attr('id'));
            $('#current').hide();
        });
    });​
    
    // HTML
    <div id="id-1">text</div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP: I have made up a function that returns an array. I would like
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
PHP's documentation on this function is a bit sparse and I have read that
php file to be available sitewide such that without require or include i simply
PHP has PHP-FPM, a pool of PHP processes that run, are managed, go away
PHP has some pretty inconsistent parameters for functions (e.g. sometimes first haystack , then
I want to count how many characters a certain string has in PHP, but
PHP 5.2.15 I am trying to replace {date[F]} with the date function. I have
PHP - Apache with Codeigniter JS - typical with jQuery and in house lib
PHP_CodeCoverage 1.1 removed the singleton accessor for PHP_CodeCoverage_Filter that allowed our PHPUnit bootstrap.php files

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.