Dynamically recover all GET from URL

Asked

Viewed 489 times

1

I am dynamically loading my views with ajax using:

view = getUrlParameter('view') ? getUrlParameter('view') : window.location.href+="?view=newusers";

$.ajax({
  method: "post",
  url: "views/empregador/" + view + ".php",
  data: {
    auth: 'ajaxrequest'
  }
}).done(function(data) {
  $('#viewa').html(data);
});

This works perfectly for cases where you access a page that doesn’t need GET parameters. However, in some precise requests I need my url to be "views/empregador/" + view + ".php?meuGet=123&meuOutroGetAleatorio=123&...".

My getUrlParameter function recovers specific URL parameters, forcing a check if 1 by 1 exists, which would be totally unfeasible for the application complexity level.

Is there any method of capturing dynamically all the Gets passed through the URL with javascript?

1 answer

4


Browser other questions tagged

You are not signed in. Login or sign up in order to post.