Javascript redirect not working after returning from a post
<p>I am using drag &amp; drop to update a user avatar, I have almost got it finished bet very very stuck and need help.</p>

<p>Am not very experienced with java..  when a user drags/drops a new image it is getting written to database &amp; uploaded properly.   All I want to do which I thought was pretty straight forward is to have the post window return via Json that an image has been uploaded, then refresh the page which would display the users new avatar.</p>

<pre><code>  &lt;script id="template-upload" type="text/x-jquery-tmpl"&gt;
  &lt;tr class="template-upload{{if error}} ui-state-error{{/if}}"&gt;
    &lt;td class="preview"&gt;&lt;/td&gt;
    &lt;td class="name"&gt;{{if name}}${name}{{else}}Untitled{{/if}}&lt;/td&gt;
    &lt;td class="size"&gt;${sizef}&lt;/td&gt;
    {{if error}}
        &lt;td class="error" colspan="2"&gt;&lt;b&gt;Error&lt;/b&gt; :
            {{if error === 'maxFileSize'}}File too large! &lt;br&gt;&lt;small&gt;(Files must be under 3Mb)&lt;/small&gt;
            {{else error === 'minFileSize'}}File too small! &lt;br&gt;&lt;small&gt;(The file must be greater than 50Kb)&lt;/small&gt;
            {{else error === 'acceptFileTypes'}}Invalid file type! &lt;br&gt;&lt;small&gt;(Upload pictures only)&lt;/small&gt;
            {{else error === 'maxNumberOfFiles'}}Max number of files exceeded
            {{else}}${error}
            {{/if}}
        &lt;/td&gt;
    {{else}}
        &lt;td class="progress"&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;
        &lt;td class="start"&gt;&lt;button&gt;start&lt;/button&gt;&lt;/td&gt;
    {{/if}}
    &lt;td class="cancel"&gt;&lt;button&gt;cancel&lt;/button&gt;&lt;/td&gt;
  &lt;/tr&gt;
 &lt;/script&gt;
&lt;script id="template-download" type="text/x-jquery-tmpl"&gt;       

&lt;tr class="template-download{{if error}} ui-state-error{{/if}}"&gt;
    {{if error}}
        &lt;td&gt;&lt;/td&gt;
        &lt;td class="name"&gt;${name}&lt;/td&gt;
        &lt;td class="size"&gt;${sizef}&lt;/td&gt;
        &lt;td class="error" colspan="2"&gt;&lt;b&gt;Error&lt;/b&gt; :
            {{if error === 1}}File exceeds upload_max_filesize (php.ini directive)
            {{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive)
            {{else error === 3}}File was only partially uploaded
            {{else error === 4}}No File was uploaded
            {{else error === 5}}Missing a temporary folder
            {{else error === 6}}Failed to write file to disk
            {{else error === 7}}File upload stopped by extension
            {{else error === 'maxFileSize'}}File is too big
            {{else error === 'minFileSize'}}File is too small
            {{else error === 'acceptFileTypes'}}Filetype not allowed
            {{else error === 'maxNumberOfFiles'}}Max number of files exceeded
            {{else error === 'uploadedBytes'}}Uploaded bytes exceed file size
            {{else error === 'emptyResult'}}Empty file upload result
            {{else}}unknown error has occured.&lt;br&gt;&lt;small&gt;(Try again later)&lt;/small&gt;
            {{/if}}

        &lt;/td&gt;
    {{else}}        


&lt;td class="preview"&gt;
            {{if thumbnail_url}}
            THIS IS WHERE I WANT THE REDIRECT TO BE SO THAT NEW AVATAR IS DISPLAYED
                &lt;a href="${url}" target="_blank"&gt;&lt;img src="${thumbnail_url}" width="80" height="80"&gt;&lt;/a&gt;
            {{/if}}
  &lt;/td&gt;
        &lt;td class="name"&gt;
            &lt;a href="${url}"{{if thumbnail_url}} target="_blank"{{/if}}&gt;${name}&lt;/a&gt;
        &lt;/td&gt;
        &lt;td class="size"&gt;${sizef}&lt;/td&gt;
        &lt;td colspan="2"&gt;&lt;/td&gt;
    {{/if}}
    &lt;td class="delete"&gt;
        &lt;button data-type="${delete_type}" data-url="${delete_url}"&gt;Sil&lt;/button&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/script&gt;
</code></pre>
