Error due to javascript - php

I'm getting the following warning message on my web page:
A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
Script: https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
How I can resolve it?
I'm using the following scripts:
<script src="https://www.markettrendsignal.com/beta/js/script.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://www.markettrendsignal.com/beta/js/thickbox.js" type="text/javascript"></script>
<script src="https://www.markettrendsignal.com/beta/js/jquery.treeview.min.js" type="text/javascript"></script>
<script src="https://www.markettrendsignal.com/beta/js/jquery.tipTip.minified.js" type="text/javascript"></script>
<script type='text/javascript' src='https://www.markettrendsignal.com/beta/js/jquery.colorbox-min.js'></script>

probably need to see more of the page. you may have some kind of recursive javascript that is taking advantage of jQuery, so the root cause is not jQuery, but the other javascript that uses it...

Related

jQuery function is not called when script src is added to head

I'm a bit of a newbie with sources etc and I took it for granted that I could simply add the script src to the header and then add as many scripts or functions as I wanted after that. For the most part this is working fine but now I hav an issue that I cannot solve.
I can either have one script running or the other, both will not work in harmony no matter how many different permutations I've tried. I'm sure there's an easy fix or something I'm missing entirely. I had a look online for an idiot's guide but didn't find anything of use.
The two function scripts are in different places. One is in the head and called from the body of the HTML pages, the other is in an include which is added to every page for dynamic links.
This loads everything Except what is within the body
<!--Creation and hiding of div to allow images load-->
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="../js/helperFunctions.js"></script>
<!-- jQuery (required) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/jquery.min.js"><\/script>')</script>
<!-- Syntax highlighting -->
<link rel="stylesheet" href="../mainCSS/prettify.css" media="screen">
<script src="../js/prettify.js"></script>
<!-- AnythingSlider -->
<link rel="stylesheet" href="../mainCSS/anythingslider.css">
<script src="../js/jquery.anythingslider.js"></script>
<script>
$(function(){
prettyPrint script here;
</script>
<script>
$(function(){
slider script here
</script>
Whilst this loads the body script but none of the others.:
<!-- jQuery (required) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/jquery.min.js"><\/script>')</script>
<!-- Syntax highlighting -->
<link rel="stylesheet" href="../mainCSS/prettify.css" media="screen">
<script src="../js/prettify.js"></script>
<!-- AnythingSlider -->
<link rel="stylesheet" href="../mainCSS/anythingslider.css">
<script src="../js/jquery.anythingslider.js"></script>
<script>
$(function(){
prettyPrint script here;
</script>
<script>
$(function(){
slider script here
</script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="../js/helperFunctions.js"></script>
I then tried putting the script src in the include, including the src twice and lots of other stupid senseless ideas.
If anyone could help it'd be great! Many thanks
Your include jQuery like three times in this code. i'm not sure if thats the problem but it ain't the solution
// jquery from jquery.com
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<!-- jQuery (required) --> // jQuery from google
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/jquery.min.js"><\/script>')</script>
// both of these are expendable
this might cause a conflict since the last one to be included is an older version of the library. you only need only inclusion. I'm assuming your using migrate because you have older jQuery code running in your scripts.
CODE ERROR
<script>
$(function(){ // syntax error
prettyPrint script here;
</script>
<script>
$(function(){ // same error
slider script here
</script>
you have syntax errors here, and any script that comes after this code will not run or work.
I had a function in one f the scripts that was returning an error. That seemed to be halting the est of the code. -.-
Also only have one instance of jquery in the head now.

how to stop local versions of jquery being loaded multiple times

I have been trying to find a way to stop my local version of Jquery and Jquery ui being loaded multiple times because of the pages I'm using are pulled in by Ajax and are reloading by Jquery every time.
The Jquery files I'm loading are
<script src="jquery-ui-1.10.3/jquery-1.9.1.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.core.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.widget.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.mouse.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.draggable.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.position.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.resizable.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.button.js"></script>
<script src="jquery-ui-1.10.3/ui/jquery.ui.dialog.js"></script>
<link rel="stylesheet" href="jquery-ui-1.10.3/themes/base/jquery.ui.all.css">
It does not matter how do you send the request. If page must be reloaded, let browser and server do theirs cashing job.
If you use ajax, load only a part of page, if you have some troubles. But you should post more code to show places with possible bugs...

jQuery script breaks another JS script

I have a calendar script I got off the internet working fine. Recently, I tried incorporating a jQuery sorting script, but I can't get both working together. It's either the calendar script or the sorting one that works.
I don't have much jQuery experience. I've tried changing the order in lots of ways, changing the jQuery versions and commenting out a bunch of JS scripts but I still can only get either get or one or none of them working.
The page is password-protected and the information being pulled from the database is private, but if it helps I'll try and make a separate page with dummy data; but I hope the mistake is a glaring one.
Here's the page head:
<head>
<title>My Page</title>
<!-- css -->
<link rel="stylesheet" type='text/css' href="stylesheets/datatable.css"/>
<link href="stylesheets/pagination.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/jquery-ui-timepicker-addon.css" />
<link rel="stylesheet" media="all" type="text/css" href="css/Aristo.css" />
<!-- scripts -->
<!-- [if lte IE 8]>
<script language="javascript" type="text/javascript" src="scripts/excanvas.js"></script> <![endif] -->
<script type="text/javascript" src="js/jquery-latest.js"></script>
<script type="text/javascript" src="scripts/jquery.datatables.js"></script>
<script type="text/javascript" src="scripts/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="scripts/jquery.placeholder.js"></script>
<script type="text/javascript" src="scripts/jquery.accordion.js"></script>
<script type="text/javascript" src="scripts/jquery.tabbed.js"></script>
<script type="text/javascript" src="scripts/application.js"></script>
<!-- If I enable this, the calendar works but the sorting script stops working:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.8.23/jquery-ui.min.js"></script> -->
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="js/jquery-ui-sliderAccess.js"></script>
</head>
Is there an obvious mistake here? I'm using someone else's jQuery. Let me know if there is any other info I can add that might help with this...
The problem is that you are loading the jQuery library twice when you uncomment the part in question. This will result in the second script overwriting the $ and therefore also all functionality the plugins above have already attached to it (their functions are living inside the $ object).
Simple solution to your problem: Only load jQuery once (preferrably via a CDN), load the original library as the first script, then load its plugins, and then load your own scripts.
The correct order should therefore be:
<!-- Loading jQuery via Google -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<!-- Loading jQuery scripts -->
<script type="text/javascript" src="scripts/jquery.datatables.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="js/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript" src="scripts/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="scripts/jquery.placeholder.js"></script>
<script type="text/javascript" src="scripts/jquery.accordion.js"></script>
<script type="text/javascript" src="scripts/jquery.tabbed.js"></script>
<script type="text/javascript" src="scripts/application.js"></script>
Your sorting script and your calendar script are using 2 different versions of jQuery. I assume the one your sorting script is pulling up is conflicting with the calendar one (the one commented out in your code). Specifically:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
and:
<script type="text/javascript" src="js/jquery-latest.js"></script>
are competing with each other.

Why doesn't script.js work when I also use plusSlider?

I have two scripts the first is script.js that uses quicksand.js and the second is plusslider.
When I use code like the following, the plusslider works but the script.js doesn't.
But, when I delete the plussslider call the script.js works fine.
How do I make them work at the same time?
This is my header.php:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.quicksand.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/script.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.plusslider-min.js"></script>
<script language="javascript">
$(document).ready(function(){
$('#slider').plusSlider({
createPagination: false,
sliderEasing: 'easeInOutExpo',
fullWidth: true,
sliderType: 'slider'
});
});
</script>
<?php wp_head(); ?>
Check to see how the links appear when you do a view source in the browser. Copy the relevant ones and make sure their addresses load the files in the address-bar.
Also, don't use language="javascript" that was old-school 5 years ago and might throw the right browser with the wrong doctype.
But trust me. Always go to the HTML first, every time. Even if that doesn't help you this time.
Also making sure you're not doing something silly in script.js like overwriting the $ namespace.
Another possible issue. Are all your resource links https? By that I mean images, CSS, other JS files, the actual page you're loading, etc...

Server not reading jquery

I created an application using PHP, mysql, and jquery. It's working fine on my localhost,m however after uploading it to the server, everything works fine but jquery, I believe it's not reading it.
Using firebug, I get the following error when trying to read the .js file in the browser:
Uncaught syntax error: Unexpected
token.
Here's how i include my scripts:
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="js/autoresize.jquery.js"></script>
<script type="text/javascript" src="js/customSelect.jquery.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript" src="js/jquery.validate.password.js"></script>
I did check my files and they exist in /js/ . What could be wrong?
UPDATE
It is working when I read :
https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
But it's not working when reading from server?
You are using relative path right now.
When you use relative path, all the requests will go to the path relative to your location.
For example, if you are on http://www.mysite.com/products/catalog.php, your browser will send the request to get the jQuery scripts from this location: http://www.mysite.com/products/js/ which certainly does not exists.
Try using the absolute path instead. In fact make a habit of!
Try the following:
<script type="text/javascript" src="/path/to/your/srcipt/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/autoresize.jquery.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/customSelect.jquery.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/jquery.form.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/jquery.validate.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/jquery.validate.password.js"></script>
Shoud be an HTTP GET request for these js file.
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
Sounds like it does not exist on the location. If you have nice urls implemented or file does not exist then it would not work, try using full path.
<script type="text/javascript" src="http://xyz.com/js/jquery-1.6.1.min.js"></script>

Categories