December 11, 2010
Posted by on
missing ) in parenthetical
This error comes due to incorrectly formatted json string.
I was trying out an ajax based image upload jquery based lib. I was using json as a response type from my server. I also noted that this error was coming while uploading only one specific image, the rest of images were working quite nicely.
I was quite confused about this error and was wondering what is wrong with this specific image. What I found out is that the image was corrupted, so my server (php) script was throwing some php errors. As I was using json as my response type, it was not properly formatting the json response, creating some invalid json string, which in return was causing error on client side (js) .
My solution was to remove any php error so that json will be formated properly. My solution was like
$data = array( “status” => “error”);
The php ob_clean() function cleans the output buffer. So any potential php error which might have occurred during file resizing will get clean out and the json format will remain valid and intact.
So remember. If you see this missing ) in parenthetical error in your firebug, this is due to you got some badly formatted json string!