• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Javascript issue

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
gregjarvis
Asked:
gregjarvis
  • 3
  • 3
1 Solution
 
Gurvinder Pal SinghCommented:
replace line 2 with
$(document).ready(function () {

and then try
0
 
gregjarvisAuthor Commented:
no luck
0
 
Sar1973Commented:
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
gregjarvisAuthor Commented:
hmm still can't get it to work...
0
 
Sar1973Commented:
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
 
gregjarvisAuthor Commented:
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
 
Sar1973Commented:
Try also changing '#twitter' to something like '#Gregstwitter' in the user name parameter: sometimes you get redundancies without beeing aware of.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now