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
You can use parse_url() to get the query string and then parse_str to get the query string parsed into variables.
Example: