My script is causing infinite loop
<p>To begin with: I'm a total newb. These functions are the first I have ever written. I use Wordpress (and the most important plugin used on the site is called BuddyPress). What I essentially want the script to make is delete something from my database and then reload the page one time when pressing a certain link. Nothing more.</p>

<p>I have an issue with Internet Explorer where my page gets stuck in an infinite loop. This problem doesn't occur on Chrome at all. I have a PHP containing the following:</p>

<pre><code>&lt;li&gt;&lt;a id="edit" href="#" onclick="runUpdateForm();"&gt;Uppdatera profil&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>When pressing the link the following script is run:</p>

<pre><code>&lt;!--Javascript runUpdateForm--&gt;
&lt;script type="text/javascript"&gt;
function runUpdateForm() {
    $.post ( ajaxurl, {
      action:'resetUser',
          user_id:jQuery("#user_id").val()
          });
    window.location.reload();
}
&lt;/script&gt;
&lt;!--End Javascript runUpdateForm--&gt;
</code></pre>

<p>In my functions-file the following is found:</p>

<pre><code>function resetUser() {
  $user_id=get_current_user_id();  
  global $wpdb;   
  $wpdb-&gt;query("DELETE FROM wp_profile_updates WHERE user_id='".$user_id."'");
  die(); // close the connection
}

add_action('wp_ajax_resetUser', 'resetUser'); // add action for logged users
add_action( 'wp_ajax_nopriv_resetUser', 'resetUser' ); // add action for unlogged users
</code></pre>

<p>After Googling a bit I found the following piece of code which I put right above location.reload():</p>

<pre><code>history.pushState("", document.title, window.location.pathname + window.location.search);
</code></pre>

<p>This made the infinite-loop go away but still it reloads one time to much in Internet Explorer, in comparision to Chrome and what I actually want to happen.</p>

<p>Sorry for my poor English. I'm a Swede :-)</p>

<p>I appreciate the help. I need someone with knowledge to tell me if they see anything right away which looks crazy and should be changed. My problem maybe is related to other stuff happening on my site.</p>

<p>Regards. </p>