jQuery .load not loading button - javascript

I've been trying to load a button from another page onto my page using jQuery. I've been following theinstructions detailed in the following url and havent beeen able to get it to work. I am still a bit new to jQuery so i may have small mistakes. Anything will help. iframe to Only Show a Certain Part of the Page
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script> $("#m").load('https://www.minds.com/theantimedia .minds-subscribe-button');
</script>
<div id="m"></div>
Update: I've been running it by opening it from an html file in my browser. I dont know if its like php and wont work. Also if i've broken any rules by posting this please warn me and i'll delete this question. Thanks!

Related

Highcharts not loading on PHP page

I am trying to implement Highcharts to display data on my web application. At the moment, I just want to see how Highchart works on my website so I have simply copied code from this fiddle and implemented it on my site. But for some reason, the chart does not display.
It may just be my inexperience (or quite frankly, my stupidity) but I don't know why the fiddle isn't loading. Have I missed anything?
Here is what I have done:
I have added the following to the head of the page:
<script src="https://code.highcharts.com"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="javascript/chart.js"></script>
chart.js is a seperate file, which consists of all the JavaScript from the fiddle.
Whenever you observe a problem, the first thing you need to check is whether there are any errors. When it comes to Javascript, you need to check the browser console. In this case, the $ in the error message is a strong hint that you forgot to include a script tag before the other script tags having its src attribute pointing to the location of jquery.

Drupal 8 and colorbox

does anybody has a practical experience with setting up the Colorbox in Drupal 8? I'm trying to have the "common" functionality so after I click the image thumbnail it will be opened withing overlay Colorbox window.
I have installed everything I'v found related to the Colorbox but no success.
In the page code I can see:
<a href="/path/to/img.jpg" class="colorbox">
Also set of the colorbox related JS files:
<script src="/core/assets/vendor/jquery/jquery.min.js?v=2.1.4"></script>
<script src="/libraries/colorbox/jquery.colorbox-min.js?v=8.0.5"></script>
<script src="/modules/colorbox/js/colorbox.js?v=8.0.5"></script>
<script src="/modules/colorbox/styles/plain/colorbox_style.js?v=8.0.5"></script>
<script src="/modules/colorbox_inline/js/colorbox_inline.js?o3m4ww"></script>
<script src="/modules/colorbox_load/js/colorbox_load.js?o3m4ww"></script>
All files are at the location as stated in src attributes above. Also Firebud doesn't show any JS related issue.
But if I click that A element the image is loaded as a new page without any Colorbox overlay :(
Thanks
So finaly - thanks to comments from Aram Boyajyan who pointed me to check the other themes where it worked, I've realized I should go back to school. Or at least back to good old times where were no CMSes or frameworks and we were supposed to pass the code throught the w3c validator to proudly display that cool icon about our site compliance ;-)
If I'd do that once I've updated each template file it would save me 3 nights of investigation.
So to summarize - due to missing some of the closing div elements Colorbox were not able to update corresponding elements properly and therefore were not working as expecte.
That's it.

Load lightbox automatically on page load

I have a lightbox that loads onclick (see the link 'test' at this page: http://www.300hours.com/test.html ). I want to modify the code so that the lightbox loads automatically when a user loads the page.
My current href is:
<a href='/uploads/1/2/2/3/12234663/4105150_orig.png' id='#interstitial' rel='lightbox' onclick='if (!lightboxLoaded) return false'>test</a>
I've tried a few Javascript and Jquery solutions posted, but so far nothing works. I'm not very familiar with JS and Jquery - I think my problem must be some kind of syntax error. Anyone who can help me out with a working sample would be much appreciated. Many thanks in advance!
Just trigger the onclick event using a jquery trigger().
$(document).ready(function(){
$("#interstitial").trigger("click");
});
It's a bit dirty but it gets the job done!

Having trouble getting list.js to work

So I am new to using JS and I have looked over the list.js site and can't seem to figure this out. I can't even get the demo to run on my server. I can get my code to work on web based places like Encode and what not, but not my server.
http://brewingbard.biz/smm/test/main-list2.html
Can someone please tell me why this is failing? I copy stuff that works in one place and put it up here and then it stops.
Your code is running before the <div id="users"> exists.
Therefore, it has nothing to operate on.
Move the invoking script block below the element.
<script src="list.js" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
Each <script> tag can only have one src.
You need to load each script in its own element.

JavaScript SRC path not working

I have searched this web looking for an answer, but it seems that this time I'm not so lucky, so I am forced to ask. I apologize if it's already answered (could not find it). And yes, English is not my first language, so I also apologize for my spelling mistakes, I try my best.
This is my problem, using Tomcat 5.5, Struts 1.3, JRE 1.5 and I'm using firefox 3.5.6.
In my jsp page I cannot seem to put any src="path/path" in my <script> I have tried deleting the src and all works well, but my project is going to need a lot of use from jquery and I do not want to copy/paste all the js file in every jsp.
This is my code:
<script type="text/javascript" src="js/jquery-1.3.2.js">
function showMySelf(){
alert("Hello World!");
}
(... plus other stuff code that actually uses jquery functions)
</script>
and the submit button:
<input type="submit" onclick="showMySelf()">
When I click the button, nothing happens (well it actually repaints the page) and when I delete the "src" tag from the script and add all the jquery code to the page it all works well.
I have tried putting another slash in the path as "/js/jquery-1.3.2.js" and returns an error.
I have tried using ResolveURL and it doesn't seem to give me better results.
I have also tried changing the js file to another file ("generics.js" and "js.js"), I also tried with "js/*.js".
Any of theese solutions have archived anything.
I have also tried using the struts tags (like html:submit) but it also did not work.
The path is actually right, since looking the code in my web browser gives me a link to the js file. So I suposse the browser knows were to look for my js file, it does not give me an error or a broken link to the file.
Any ideas of why this is happening?
Thank you all.
Random.
You can not use a script element to load an external file and put code in it at the same time. You need to use two script elements:
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
function showMySelf(){
alert("Hello World!");
}
(... plus other stuff code that actually uses jquery functions)
</script>
I think Gumbo solved it.
As a sidenote, a very good way to find out whether a browser can load a JS file is the "Net tab" in Firebug in Firefox. It shows all loaded (and failed) requests of the current page.
The two most likely options are:
a) You are including HTML in your JS file (i.e. <script> tags)
Take it out.
b) You have the wrong URI and when you attempt to resolve your relative URI manually you do so incorrectly
Look at your server access logs to see what is actually being requested (or use a tool such as Firebug)
The first thing to do in such case. Install Firebug and look at the "Console" panel (for possible syntax errors) and the "Net" panel to see whether your jQuery sources are being fetched correctly. The 2nd column there shows the request status code.
alt text http://img46.imageshack.us/img46/6224/jqueryfirebugtmp.jpg
(full size image)

Categories