i am trying to get value from a location href link and was able to get the location href link through jquery and i used
var loc =$(location).attr('href');
using this i got the value
localhost/example.com/buy.php?ev=product_search&type=sb&search=sony&cat=3
now hot to get value of type , search and cat from this link ?
for eg
type=sb
search=sony
cat=3
my full code
$("input:radio[name=type_radio]").click(function() {
var loc =$(location).attr('href');
var value = $(this).val();
var type="condition";
alert(loc);
var dataString="value="+ value + "&type=" + type;
$('.srchcntntagn').css('display','block');
$('.by-product-list').addClass('opfxsc');
$.ajax({
type: "POST",
url: "modules/buy&sell/load_search.php",
data: dataString,
cache: false,
success: function(html){
$('.by-product-list').removeClass('opfxsc');
$('.by-product-list').html(html).fadeIn('slow');
$('.srchcntntagn').css('display','none');
}
});
});
I usually use this “gup” funciton found here: http://www.netlobo.com/url_query_string_javascript.html
You just add the function to your script then do something like:
This also eliminates the need for grabbing the URL with the .attr(‘href’) call.
The function itself is: