/*
It's a simple function to get the URL params,
you can send the URL within the method parameters
or you can use 'window.location.href' to get the actual URL.
Obs: This only works for all the URL, if you just want to
send the params (after the '?'), you have to send a '?' before the params.
*/
function getUrlParams(url) {
var params = {};
url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str, key, value) {
params[key] = value;
});
return params;
}