I have some javascript that's loading just perfectly at the bottom of my site. I wanted to externalize this aforementioned js, so I'm now linking to the code externally, but now the code breaks and is pointing to an error (not within the js file but the jquery file). What changes when the js is externalized? Are variables retrieved in the same way?
Thanks
You probably added the <script> tags in the wrong order.
you can probably use firebug and see whats happening there.
there is net panel which shows whethere that particular js is downloaded propery or not.
after that you can see the errors on the console window of firebug to find what exactly is the error.
Related
I'm working on a new Acumatica screen for our company that will require some javascript code to retrieve and display a map object (from ESRI).
This code requires an external .js file that is included to the HTML by the javascript code itself. Everything works fine if I use a blank HTML page to test this.
The problem I have is that when I try using the same code from inside the Acumatica screen, it doesn't load this required external file, and therefore the code does not work properly.
I attempted to load the full .js file code along with my code, but it returned the following error:
error CS8095: Length of String constant exceeds current memory limit. Try splitting the string into multiple constants.
I haven't tried splitting this file into multiple strings (as the error message suggests), because I want to make sure there isn't a cleaner and more professional, direct/right way to do this.
Is it possible to manually import this external .js file into our Acumatica instance, so I can point to it instead? (in case it makes a difference if it's hosted in the same environment)
or, is there any way to make Acumatica able to load external files so we can keep using our current approach? (any setting that may be preventing external files from loading?)
I'm not sure i fully understand the question. What comes to mind however is you may be looking to use the PXJavaScript control. I used this link to help get my head wrapped around how to use the control. We had a need to trigger something off with Java Script and the PXJavaScript control got us to the end result we needed. Let me know if this gets you in the right direction?
Dynamically Change Button Color
I'm taking over a flask project where the previous dev wrote quite a bit of their javascript/jquery in inline script tags in template files instead of separate js files in a static folder.
There's an issue with table cell highlight occuring after a long delay and I can't find the source in firefox/chrome debugger to step through the code. All the javascript I see is from the base template(can't see this either in chrome).
How do I view this injected template html and internal javascript in the debugger or is there another way to debug this without reworking the entire template and moving the javascript to another file?
I did not see in firefox debugger a javascript file that I placed in the static folder and referred from *.html file.After following this tutorial I saw that it is possible. I started commenting out parts from my application, hoping to find which part is causing this issue.In the end, I found out that my javascript file contained wrong syntax in one of the "if" conditions:
if foo() {
instead of
if (foo()) {
I am unable to include any javascript file in either the _Layout.cshtml or any other view. When I do so, I get the error "javascript critical error at line 3...". I'm using IE to browse. Errors are not shown in Chrome though. I am including the js file at the bottom of the view like this:
<script src="~/Content/bootstrap/js/bootstrap.min.js"></script>
The error is not specific to this file, any js file gives the error. I also tried sing the url.content, no luck. Thanks
To me it seems quite unrelated to ASP.NET since you are including a static JS file, so it's pure HTML.
I suppose in this case you should remove the tilda character ~ from file URL.
I am using Dreamweaver CS6 (and most recently, CC).
We have a javascript file that is included in every page, but its dynamically included through nested layers of PHP includes, so when I type in a function name, DW does not know it is part of the page, and therefore does not give me the code hints (vs if I am actually in that js file, code hinting works like a charm).
I am looking for a way to have DW pick up that file and/or give me code hints for any functions and namespaces I place in there, but so far, have come up empty.
Has anyone had any success with doing this?
I have been searching for this answer for far too long, and I think I've found it! It has to do with "site-specific code hinting". Take a look at this link: https://www.inkling.com/read/dreamweaver-cs6-missing-manual-david-sawyer-mcfarland-1st/chapter-22/php-code-hints
It worked for me. I am now able to see all variables from nested includes.
I want to run the following jquery code on every page in my website.
$(document).ready(function(){
$("#more").click(function(){
$("#morediv").slideToggle("slow");
return false;
});
});
In all my pages I have the more and morediv elements defined, for every page I have different js file and adding this code in every file will not be a good solution (I suppose).
I have created a global.js to include this code, but in other pages also I have the $(document).ready(function(){} function defined and may be that's why its conflicting and not running properly.
You can have multiple $(document).ready(function(){}) elements on your page, so that it's the problem. I suggest using Firefox/Firebug and examining any console errors you find to discover the problem. Perhaps your global.js file is being loaded before jQuery itself? Otherwise, you'll need to dig into it with Firebug's debugger.
Are you actually doing some server-side programming or you are talking about plain HTML pages. I would advise that you have templates (this is specific to your development environment and tools of choice) and include the JS in those templates. Then the actual pages will all use the template and have the JS available. The question you are asking has in fact nothing to do with Javascript or JQuery, but the way you organize your site... unless I'm missing something.
having $(document).ready() event handler in global.js and the page it is included in does not poses any problem I'm using it and it works really fine.
Just a guess, but are you referencing the location of the global.js file correctly?
To be sure, write something like the following into your global script:
$(document).ready(function(){
alert("document ready");
$("#more").click(function(){
$("#morediv").slideToggle("slow");
return false;
});
});
If you don't get the alert the script is not pathed correctly, or is not placed after the jquery include (or the jquery include is not pathed properly).