How to orderly load jquery libs with requireJS?

How to use requireJS to load the Jquery libs in the orderly manner? So the dependency between the Jquery, datatables and the plug-in are taken care of?

Also, I am working on the enhancement of a ugly-coded legacy app. The datatable grid is placed in a partial view, with all the <script></script> to load the jquery, datatable, tableTools, etc. I realized that the asyn nature of the requires may be the cause of the various "uncaught" or "undefined" error. Any help on how to handle this situation will be highly appreciated.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexandre SimõesManager / Technology SpecialistCommented:
First part, the dependencies with jquery (or any other library)
RequireJS is made to manage dependencies between modules, so this requirement is part of the "deal".
I think that better than rewriting the whole thing my way, the best is to point you to their documentation regarding this specific topic.
After reading that, come back here if you have any doubts.

The second problem is the in-line javascript, which is a bad practice despite you're using RequireJS or not.
In this case, what I recommend is to copy the whole code into a RequireJS module.
You'll clean up your code without big regression risks and it will be RequireJS compliant.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chuang4630Author Commented:
I am cleaning up the mess. Want to see what happen then.
Meantime, I have another problem. see the question 28696080

Do you have a chance to take a look at it?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.