How to grab current url and use it in load() function in jQuery?
<p>I want to reload the content of the page I am on, so I am grabbing the div I want to reload of  the same page in url as I am currently on and it is working:</p>

<pre><code>success : function(msg)
        {
            $('#div-to-reload').load('http://localhost/page-i-am-currently-on.php #div-to-reload');
        }
</code></pre>

<p>But I need it to be done dynamically so javascript find out the current URL and append it instead of the hardcoded url </p>

<blockquote>
  <p><code>http://localhost/page-i-am-currently-on.php</code></p>
</blockquote>

<p>.</p>

<p>I have tried this, but it is not working ;( :</p>

<pre><code>success : function(msg)
        {
            var pathtopage = window.location.pathname;
            $('#div-to-reload').load('pathtopage #div-to-reload');}
</code></pre>

<p>Thanks in advance, for any help.</p>
