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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:46:27+00:00 2026-05-19T13:46:27+00:00

i am using http://www.asual.com/jquery/address/ plugin and trying to parse some url, this is what

  • 0

i am using http://www.asual.com/jquery/address/ plugin and trying to parse some url, this is what i got:

<script>$(function(){
      $.address.init(function(event) {

                // Initializes the plugin
                $('a').address();

            }).change(function(event) {

 $('a').attr('href').replace(/^#/, '');

    $.ajax({
  url: 'items.php',
  data:"data="+event.value,
  success: function(data) {
    $('div#content').html(data)

      }
   })

});


})</script>

then HTML:

<a href="items.php?id=2">link02</a>
<a href="items.php?id=3">link03</a>

then im calling item.php, wich for now only has

echo $_GET["data"];  

so after the ajax request has complete it echoes :

/items.php?id=2
/items.php?id=3

how can i parse this so i get only the var values? it is better to do it on client side?
and also if my html href is something like <a href="items.php?id=2&var=jj">link02</a>
jQuery address will ignore the &var=jj

cheers

  • 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-19T13:46:28+00:00Added an answer on May 19, 2026 at 1:46 pm

    You can use parse_url() to get the query string and then parse_str to get the query string parsed into variables.

    Example:

    <?php
    
    // this is your url
    $url = 'items.php?id=2&var=jj';
    
    // you ask parse_url to parse the url and return you only the query string from it
    $queryString = parse_url($url, PHP_URL_QUERY);
    
    // parse_str can extract the variables into the global space or can put them into an array
    // NOTE: for simplicity no validation is performed but in production you should perform validation
    $params = array();
    parse_str($queryString, $params);
    // you can access the values like thid
    echo $params['id']; // will output 2
    echo $params['var']; // will output 'jj'
    // I prefer this way, because it eliminates the posibility of overwriting another global variable
    // with the same name as one of the parameters in the url.
    
    // or you can tell parse_str to extract the variables into the global space
    parse_str($queryString);
    // or if you want to use the global scope
    echo $id; // will output 2
    echo $var; // will output 'jj'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial
Say I want to get the HTML of http://www.google.com as a String using some
Is there a way of getting the websites absolute URL ( http://www.domain.com/ ) using
I'm using this in my website: http://www.dynamicdrive.com/dynamicindex3/scrolltop.htm and it works great for me. But
I'm using http://urlrewriter.net/ to rewrite urls at my website. For example, I'm rewriting: http://www.example.com/schedule.aspx?state=ca
I'm looking at using CompositeWPF ( http://www.codeplex.com/CompositeWPF ) - aka Prism, to build an
I'm using the .NET TWAIN code from http://www.codeproject.com/KB/dotnet/twaindotnet.aspx?msg=1007385#xx1007385xx in my application. When I try
I've been using ISAPI_Rewrite from Helicon ( http://www.helicontech.com/isapi_rewrite/ ) on a Server 2003 box
I'm using a COM object that has a function called GetImage. http://www.pdf-tools.com/asp/products.asp?name=P2IA When I
How to do that: http://download.oracle.com/javase/tutorial/uiswing/components/spinner.html using that: http://www.scala-lang.org/api/current/index.html#package ?

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.