Solved

Javascript issue

Posted on 2012-04-06
7
156 Views
Last Modified: 2012-10-09
I'm trying to call a function from a seperate js file; this works if its on a standalone page, but with other elements in the body of a page, it will not work. i know it has to do with the document.get but not sure how to make it play nice with everything else on the page

(this is simply pulling a twitter feed and displaying it)

<script type="text/javascript">
$(document.get).ready(function () {
	$('#twitter').twitterfeed('facebook', {
		limit: 10
	});
});
</script>

<div id="twitter"></div>

Open in new window

0
Comment
Question by:gregjarvis
  • 3
  • 3
7 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 37816660
replace line 2 with
$(document).ready(function () {

and then try
0
 

Author Comment

by:gregjarvis
ID: 37817021
no luck
0
 
LVL 9

Expert Comment

by:Sar1973
ID: 37819076
I knew that you can call functions included in a separate .js file like this, even including other customized functions:
<script language="JavaScript" src="myJSCode.js">
function myFunction1(){
.....
}
</script>
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:gregjarvis
ID: 37825000
hmm still can't get it to work...
0
 
LVL 9

Accepted Solution

by:
Sar1973 earned 500 total points
ID: 37825017
Another cause could be that you have 2 functions with the same name both in the .js file and in the script declaration of the page.
0
 

Author Comment

by:gregjarvis
ID: 37825120
http://www.zazar.net/developers/jquery/ztwitterfeed/

that is the site im taking the code from. for example, that script wont work on the same page as say this one
http://www.zazar.net/developers/jquery/zweatherfeed/
0
 
LVL 9

Expert Comment

by:Sar1973
ID: 37825736
Try also changing '#twitter' to something like '#Gregstwitter' in the user name parameter: sometimes you get redundancies without beeing aware of.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question