Hi guys,
It happens to me quite frequently that I have some issue in an AJAX calls. On Chrome, I see: Uncaught SyntaxError: Unexpected token $ in JSON at position 0 at JSON.parse (<anonymous>) at Function.n.parseJSON (jQuery.js:4) at HTMLDocument.<anonymous> (reps?_s=YZ0L_G1AYPiERSfd&_k=lD9O_xh3oh59qMMq:453) at HTMLDocument.dispatch (jQuery.js:3) at HTMLDocument.r.handle (jQuery.js:3) at Object.trigger (jQuery.js:3) at x (jQuery.js:4) at XMLHttpRequest.b (jQuery.js:4) But there is no way for me to know what triggered that at Seaside level. If I inspect the "VM2043:1" kind of link in the Chrome console, I get to the script generated by my ajax which is something like: $("#id174").replaceWith("<div class=\"companyReportMainDiv\" id=\"id232\"><div id=\"popupContainer9358488\" class=\"popupContainer\"></div><script .......... ) Chrome shows me that with a red underline like if that would have an error, but such JS is correct. Any idea how can I know what is going on? _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Fri, Feb 10, 2017 at 5:02 PM, Mariano Martinez Peck <[hidden email]> wrote:
OK, the JSON failure was due to my AJAX error handler, which was trying to do (see bold part) var requestResponse = { url: settings.url, method: settings.type, data: settings.data, httpStatus: jqxhr.status, error: exception || jqxhr.statusText, data: settings.data }; responseText = jqxhr.responseText; responseText.replace(/[\\"'']/g, ''\\$&'').replace(/\u0000/g, ''\\0''); console.error(requestResponse); jsonValue = jQuery.parseJSON(responseText); I am now printint to console the requestResponse that was in this ajax error handler, and this is what I get:
SyntaxError: Unexpected token ,
at eval (<anonymous>)
at https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:2:2616
at Function.globalEval (https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:2:2627)
at n.fn.init.domManip (https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:3:22515)
at n.fn.init.replaceWith (https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:3:21650)
at eval (eval at <anonymous> (https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:2:2616), <anonymous>:1:13)
at eval (<anonymous>)
at https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:2:2616
at Function.globalEval (https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:2:2627)
at text script (https://debrisdemo.quuve.com/JQDeploymentLibrary/jQuery.js:4:26788) I don't understand what is going on. Any ideas? Thanks in advance
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hey Mariano,
There’s a syntax error somewhere. Ok… that’s a lousy response, I know :) Can you fetch the generated JS from the url and send that in a text file? Just to be sure: is this happening with the result of a jQuery script callback? It would be good to know what Seaside-JS code that is executing to generate the script you are sending. Johan
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |