Cybercrux

Everything is achievable through technology

Querystring

fiddler

var realurl =’www.example.com?param1=name&param2=ss&id=6′
//var realurl =’www.example.com’
if(realurl.indexOf(‘?’)>-1)
{
var queryStrings= JSON.parse(‘{“‘ + decodeURI(realurl.slice(realurl.indexOf(‘?’) + 1).replace(/&/g, “\”,\””).replace(/=/g,”\”:\””)) + ‘”}’)
queryStrings[‘aa’]=100;
console.log(realurl.slice(0,realurl.indexOf(‘?’))+”?”+jQuery.param(queryStrings));
}
else
{
var queryStrings={};
queryStrings[‘aa’]=100;
console.log(realurl.slice(0,realurl.indexOf(‘?’))+”?”+jQuery.param(queryStrings));
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s