How do I get current url in Javascript?

4

I'm using jQuery. How do I get the current and complete URL path, I want to assign it to the current url variable.

$("#id_ativo").change(function(){

   $.ajax({
      type: "POST",
      url: url_atual,
      ...
    
asked by anonymous 23.07.2015 / 22:34

1 answer

13

Try using the code below

var url_atual = window.location.href;
    
23.07.2015 / 22:37