Teammates: Clean up the AJAX calls

Created on 16 Jun 2017  路  5Comments  路  Source: TEAMMATES/teammates

It's an unholy, filthy mess right now, with AJAX calls in several files requesting HTML snippets and just chucking them into the DOM in a sloppy, error-prone and unmaintainable way.

Ideally, AJAX calls should request for JSON snippets, and we should have a standardised, easy-to-understand way to insert them into the page. Now that we have ES6, we can make full use of its features to build proper AJAX infrastructure.

(Perhaps we can explore the use of something like Vue.js, but maybe we shouldn't go that far. :stuck_out_tongue: @whipermr5 )

a-CodeQuality c.Epic p.Medium t-Java

Most helpful comment

Not trying to discourage or anything because it is a legitimate issue, but I hope you understand the magnitude of what this issue entails...

All 5 comments

Not trying to discourage or anything because it is a legitimate issue, but I hope you understand the magnitude of what this issue entails...

@wkurniawan07 I'm painfully aware. :laughing:

@thenaesh As someone who is writing new AJAX functions, what should I keep in mind while implementing that would be in keeping with the AJAX standards expected of this PR issue. Given that the infrastructure to systematically place JSON responses into the DOM doesn't yet exist, should I still be avoiding chucking HTML into the DOM? Or would it be okay to carry on as per existing examples in code?

@HirdayGupta Ideally, try to keep the AJAX handling code modular, such that the parts doing the actual insertion into the DOM are kept separate from the other parts and easily replaceable.

This is V7's biggest achievement, by far.

Was this page helpful?
0 / 5 - 0 ratings