Atlas with inline or external JavaScript – Unknown Error

More issues with Atlas and your own client javascript.

Today I stumbled accross another isse of my own JavaScript causing errors with Atlas. Typically you place all your JavaScript in the HEAD of the document. So.. today I added the following function to my JavaScript in the HEAD of the page.

javascript_form_submit

Atlas - Unknown ErrorAfter adding this code, any click on the page that used an Atlas Update Panel, caused the discreet Unknown Error dialog box. After many attempts to discove what the problem may be, I moved the entire function to script tags with-in the BODY of the page. All worked fine, with no Atlas “Unknown Error”.

I decided to test another sceniario, and put all my JavaScript in an external file (I usually wait till I am finished with the page for this step) and included it from with-in the HEAD of the page. Again I tested the page and all worked fine with no Atlas “Unknown Error”.

I thought this error may have something to do with the partial rendering that Atlas is taking care of, but after my second test, I an not so sure any more. Either way, I believe it may be a better practice to put all JavaScript in an external .js file and include it in the HEAD of your page.

6 thoughts on “Atlas with inline or external JavaScript – Unknown Error

Add yours

  1. You can use this in the head:

    //

    This way the javascript won’t be parsed as html, and Atlas will not throw the “Unknown error”. Actually, you’ll only get the error when special characters like “” are used in the javascript code.

  2. I haven’t tested w1ll3m’s suggestion, but it sounds reasonable. Sorry the comment system of WordPress does not allow the posting of special characters for your code in comments.

    Michael, in the HEAD of your HTML doc, you use the the following statement to reference an external JavaScript file.
    (script language=”javascript” src=”scripts/Dashboard.js”)(/script)

    NOTE: I used curly brackets, instead of regular code brackets Less Then and Greater Then.

  3. what if i have a masterpage? I have the JavaScript code inside a page that uses a master page. it is written inside a script tag. I tried to move all functions inside the script tag to an external JS file and set the src attribute of the script tag to this external JS file but in vain :(. please do you know what should i do? please reply sooooon
    thank you

  4. lamees, I have not used MasterPages so I can’t be of much help there. But it can’t be that much different. Can you share a code example some how?

Leave a comment

Blog at WordPress.com.

Up ↑