0

I have to handle request parameter on html page which is called by Ajax Request. My Code is:

$.ajax({
   type: "GET",
   url: "abc.html",
   data: "cat=1",
   dataType: "html",
   success: function(data) {
   $("#div").html(data);

  }
});

Now on abc.html page, I want to use "cat" request parameter. How its possible?

dhrut
  • 147
  • 1
  • 9

1 Answers1

0

Hope this link may help you - http://jquery-howto.blogspot.in/2009/09/get-url-parameters-values-with-jquery.html

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

Source : jquery get querystring from URL

Community
  • 1
  • 1
Anuraj
  • 18,859
  • 7
  • 53
  • 79