i am tring to display tweets to my android emulator using phonegap and jquery plugin for twitter api.
when i run the code in browser its working fine but when i try to run it on emulator its showing me some reference error in ddms console….
here is error …
04-06 12:18:40.813: ERROR/Web Console(486): ReferenceError: Can't find variable: $ at file:///android_asset/www/index.html:32
and here is code which i have written…
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta charset="UTF-8" />
<title>Tweet! Put Twitter on your site with this simple, unobtrusive jQuery widget</title>
<link href="index.css" rel="stylesheet"/>
<link href="jquery.tweet.css" rel="stylesheet"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="jquery.tweet.js" charset="utf-8"></script>
<script>
$(function(){
alert("Hello . . .sms. .. . ");
$(".tweet").tweet({
join_text: "auto",
username: "VJAnusha",
avatar_size: 48,
count: 10,
auto_join_text_default: "we said,",
auto_join_text_ed: "we",
auto_join_text_ing: "we were",
auto_join_text_reply: "we replied",
auto_join_text_url: "we were checking out",
loading_text: "loading tweets..."
});
});
</script>
</head>
<body>
<div class='tweet query'></div>
<script type="text/javascript">
**$(function(){ $(".example").each(function(i, e){ eval($(e).text()); }); });**
</script>
</body>
</html>
i have highlighten the line where it’s showing me error ….
thnks
The error is saying that it couldn’t found the JQuery Library. Try verifying that your emulator is connecting to the internet.
Anyway, when deploying an app instead of using JQuery from Google’s CDN you should just download JQuery and use a local version:
Otherwise your app won’t be able to work without an internet connection.