Answer the question
In order to leave comments, you need to log in
How to work with variables in RequireJS?
I was going to implement RequireJS in my project, but there is one gag that I don’t know how to solve correctly using RequireJS.
Now when I load the script on the page, I do it like this:
<script data-name="cabinet" src="/public/js/cabinet.min.js?c={{contract|url_encode}}&k={{apikey|url_encode}}&icq={{icq.uin|url_encode}}&sms={{sms.phone|url_encode}}&email={{email.address|url_encode}}"></script>
function getParamByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(me_src);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question