Reputation: 15960
I am in some unusual kind of situation.
Look at the code below
HTML:
<a href="?productid=13&refer=1&opr=view" title="Click to view details or Mark as 'Featured Product'" id="product_13">Demo Product</a>
and my jQuery code looks like
jQuery('a[id^="product_"]').bind("click", function(){
... calling ajax ... with following parameters ...
this.href
});
and on server-side, using PHP, I get all those parameters differently
$_GET['productid']=13
$_GET['refer']=1
$_GET['opr']=view
but I need to get as single string (?productid=13&refer=1&opr=view), any help guys?
Thanks
Upvotes: 0
Views: 411
Reputation: 4841
To get $_GET contents as single string, you can use
$url = $_SERVER['QUERY_STRING'];
Isn't it easier to just add specific class to your link, like "product_link", so you can
jQuery('a.product_link').bind("click", function(){ /* your code here */ });
This way you are relying only on your abstract class name and not on URL.
Upvotes: 2