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>
Related
I use symfony version 1.4.1
Source I want to realize
<script type="text/javascript" src="//code.jquery.com/jquery-1.12.1.min.js"></script>
I wrote view.yml(apps/masao/config/view.yml)
javascripts: [//code.jquery.com/jquery-1.12.1.min.js]
This is the result.
<script type="text/javascript" src="/masao//code.jquery.com/jquery-1.12.1.min.js"></script>
Since this site has both http andhttps possibilities, I want to write src = "// ..."
I am using jQuery in php.
Plugin as jQuery-1.7.1.min.js
For validate: jQuery.validate.min.js
For date picker: jQuery-1.10.2.js, jQuery-ui.js
If I added the script tag in following manner validate js file is worked
<link rel="stylesheet" href="js/jquery-ui.css">
<script src="js/jquery-1.10.2.js"></script>
<script src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
If I added the script tag in following manner datepicker js file is worked
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script src="js/jquery-1.10.2.js"></script>
<script src="js/jquery-ui.js"></script>
Both are not working in the same time.
Is there any wrong in my code?
Please help to solve this problem...
Either use..
<script src="js/jquery-1.10.2.js"></script>
or
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
You were using both jQ version which will make confliction
You don't have to add two different versions of jQuery.
Use it like this:
<script src="js/jquery-1.10.2.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script src="js/jquery-ui.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.
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...
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...