Note that there are some explanatory texts on larger screens.

plurals
  1. POAjaxFileUpload SyntaxError: missing } in XML expression
    text
    copied!<p>I'm trying to upload a file using $.ajaxFileUpload. My server script is returning a json object eg. </p> <p>{"imgName": "test.jpg", "imgUrl": "/uploadtest/images/profile/sam.jpg"}</p> <p>When I check in firefox it shows the correct response. Json is also received. But still I'm getting an error in alert:</p> <pre><code>SyntaxError: missing } in XML expression </code></pre> <p>I couldn't understand why this error is shown up. Also in firebug Json object is shown correctly.</p> <pre><code>&lt;script type='text/javascript' src='/js/ajaxfileupload.js'&gt;&lt;/script&gt; &lt;script type='text/javascript'&gt; function doFileUpload(){ $("#loading") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload( { url:'/json/image/upload.html?action=saveImage&amp;nameSpace=tot', secureuri:false, fileElementId:'imgFile', dataType: 'json', success: function (data, status){ alert("Success: "+data.imgUrl); }, error: function (data, status, e){ alert("Error: "+e+"---URL: "+data.imgUrl); } } ) } &lt;/script&gt; </code></pre> <p>.... ....</p> <pre><code>&lt;div&gt; &lt;strong&gt;Upload Images:&lt;/strong&gt;&lt;br&gt; &lt;input type='file' name='imgFile' id='imgFile'&gt;&amp;nbsp;&amp;nbsp; &lt;img src='/images/loading.gif' id='loading' height='60px' width='60px' style='display:none'&gt; &lt;br&gt;&lt;button name='upload' id='upload' onclick='return doFileUpload();'&gt;Upload&lt;/button&gt; &lt;/div&gt; </code></pre> <p>Anyone can tell me what's the reason for the Error?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload