Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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