1

I have added JS as a field on Joomla Seblod, which calls a JS file in my file system my_profile.js as follows-

jQuery.getScript("/components/com_msp/js/my_profile.js")
    .done(function(script, textStatus) {
    console.log('inside success in seblod');
    main();
}).fail(function( jqxhr, settings, exception ) {
    console.log('JS failed in seblod..');
    console.log(JSON.stringify(jqxhr));
    console.log( "Error:" + settings + ' : ' + exception );
});

On Chrome, the JS is called correctly and all the code works (I also get inside success in seblod message on the Inspect console), but on IE I get this on the console-

The code on this page disabled back and forward caching.
JS failed in seblod..
Error:parsererror : SyntaxError: Expected identifier

The code inside the files and everything is the same. Till yesterday I could see the changes on IE as well.

  • Have you tried contacting the Seblod developers to see if they have a fix for you? – Lodder Oct 31 '19 at 7:50
  • It was being caused because of- Error:parsererror : SyntaxError: Expected identifier error above. Just some operators/identifiers that IE refuses to accept, and I had to find alternatives to do what I was looking for. – manishk Oct 31 '19 at 16:23
1

parsererror : SyntaxError: Expected identifier was actually causing issues with the JS code on IE. I had to do a line by line debug and finally found 2 instances in the code that was causing this-

  1. I was using this to loop through an object- for(const [serial, dates] of Object.entries(data)) {. Had to replace this with a simpler for...in loop like- for (var serial in data){ if (data.hasOwnProperty(serial)) {

  2. I'm using sweetalert in my script and a .then((result) => { inside it, and on some digging I found that IE doesn't take the arrow operators. So instead of that I used a queue on sweetalert actions and basically did the same steps but without the arrow operator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.