I am trying to get this jGrowl working but I am not having any luck and I am struggling to find any help with the issue I have.
I have connected to the CSS and JS pages correctly:
<script type="text/javascript" src="<?php echo $base; ?>jgrowl/jgrowl.js"></script>
<link type="text/css" rel="stylesheet" media="all" href="<?php echo $base; ?>css/jgrowl.css"/>
And I am trying two different methods to get it working, the first method is the method that I actually want, which is when an if statement is run it should show the jGrowl window like below:
if ($flag == "OK")
{
?>
<script type="text/javascript">
$(function()
{
$.jGrowl("HELLO");
}
);
</script>
<?php
}
But this gives me no luck, so I am also trying an onclick
version:
<p><a href="javascript:void(0);" onclick="$.jGrowl('One more message...');">Click here.</a></p>
This also give me no luck, but what does happen with this on is in Google Chrome's console it gives me this error:
Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'jGrowl'
I have tried to find help based around this error but have had no luck, hope someone can help!
Thanks guys.
---------------- UPDATE ------------------
I have been playing around a bit and I a little more information out of the error in the Google Chrome Console...
Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'jGrowl'
(anonymous function) index.php:572
f.extend._Deferred.e.resolveWith jquery-latest.min.js:2
e.extend.ready jquery-latest.min.js:2
c.addEventListener.C jquery-latest.min.js:2
Im not 100% sure but I think jquery-latest.min.js
is referring to:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
Which I use to enable facebook commenting within the website. Could this be an issue?
---------------- UPDATE ------------------
If I comment out
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
Then my jGrowl works, any idea how I can get around this? otherwise I cant have both jGrowl and facebook commenting.
---------------- UPDATE ------------------
I now understand what is going wrong, I had both:
<script type="text/javascript" src="<?php echo $开发者_开发问答base; ?>js/jquery-1.4.2.js"></script>
and
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
I was not aware the the second one of these two is also getting the main jQuery library therefore causing the problems with my jQuery. All is fixed an sorted now.
------------ PROBLEM SOLVED -------------
I realised that I was linking to the jQuery libary twice by accident, all fixed now.
@Brad there are 3 ways of doing it:
Link to file
<script type="text/javascript" src="<?php echo $base; ?>js/jquery-1.4.2.js"></script>
Link to latest-min
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
Link to google
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
But you can only have 1 of these, if you have more than 1 your jQuery/JavaScript will fail
精彩评论