Solved

Javascript issue

Posted on 2012-04-06
7
152 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
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 how to dynamically set the form action using jQuery.
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)

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now