title: How do i reload  same page using window.location in jQuery?
body: <p>I have a JQuery Function </p>
  
  <pre><code>(function ($) {
  jQuery.fn.saveUser = function(destinationUrl) {
      this.click(function() {
          var formData = 'option=saveuser&amp;'+$('form#save-user').serialize();
          $.ajax({
              type: 'POST',
              url:  'process.php',
              data: formData,
              success: function(msg){
                  if(msg === 'empty') {
                      alert('Required Values Missing');
                  } else if(msg === 'duplicateEmail'){
                      alert('Email already exist');
                  } else {
                      window.location = destinationUrl;
                  }
              }
          });
      });
  }
  </code></pre>
  
  <p>now based on some actions and events, i redirect it to different pages, in this case i need it to redirect it to two different url. </p>
  
  <pre><code>1) reload the same page preserving all $_GET variables via URI
  
  2) reload to the specified url.
  </code></pre>
  
  <p>the below jQuery code can redirect me to any specific url.</p>
  
  <pre><code>$('form#save-user button[name="save-user-close"]').saveUser(function() {
      return 'index.php?users';
  });
  </code></pre>
  
  <p>however i am not getting how do i make it redirect to the same page for example.</p>
  
  <pre><code>$('form#save-user button[name="save-user-close"]').saveUser(function() {
      return location.reload(true);
  });
  </code></pre>
  
  <p>i know the above code will not work, i am confused on how do i go with this? </p>