There are several solutions to the conflict between $ of NVelocity and $ of Jquery:
1、
use. For example: var j = (); ();
Disadvantages: When using jQuery related plug-ins, the plug-in will be invalid!
2、
Use jQuery instead of $. For example:();
Disadvantages: Not suitable for expansion, once replaced with a third-party library, it will be a big deal
3、
Conflict method in wrap jQuery.
If $.ajax() conflicts in Velocity, then redefine it as follows:
function dw(){}
=function(s){ (s); } ();
4、
Define a $JQ as $. In the future, you can use ${JQ}AJAX in js.
Write (definition) like this in the front desk:#set($JQ="$.")
I recommend the fourth method.
1、
use. For example: var j = (); ();
Disadvantages: When using jQuery related plug-ins, the plug-in will be invalid!
2、
Use jQuery instead of $. For example:();
Disadvantages: Not suitable for expansion, once replaced with a third-party library, it will be a big deal
3、
Conflict method in wrap jQuery.
If $.ajax() conflicts in Velocity, then redefine it as follows:
function dw(){}
=function(s){ (s); } ();
4、
Define a $JQ as $. In the future, you can use ${JQ}AJAX in js.
Write (definition) like this in the front desk:#set($JQ="$.")
I recommend the fourth method.