Thursday, March 24, 2011

Get querystring using Jquery

You need the jquery query plugin (jquery.query.js)
Code:

$(document).ready(function(){
  $.query = $.query.load(location.href.toLowerCase());
  ResTypeId = $.query.get('resourcetypeid');
  ResId = $.query.get('resourceid');
});

The function $.query.get('..') returns empty string if the querystring param does not exist.

No comments:

Post a Comment