Instructables

javascript is not working on 000webhost free service?

I am creating a web app using jqtouch and the ical project. When I test my progress locally it works like a charm but when I upload my files the javascript file that starts i cal does not work and there is nothing shown up.Furthermore the jqtouch javascript files work perfectly.I use 000webhost free service. My site is webstore.web44.net my code:

I am creating a web app using jqtouch and the ical project.
When I test my progress locally it works like a charm but when I upload my files the javascript file that starts i cal does not work and there is nothing shown up.Furthermore the jqtouch javascript files work perfectly.I use 000webhost free service. My site is webstore.web44.net
my code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />

<style type="text/css" media="screen">@import "jqtouch/jqtouch.css";</style>
<style type="text/css" media="screen">@import "themes/artspot/theme.css";</style>
<style type="text/css" media="screen">@import "jqt.calendar.css";</style>
<script src="jqtouch/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script>
<script src="jqtouch/jqt.icalendar.js" type="application/x-javascript" charset="utf-8"></script>
<style type="text/css" media="screen">@import "../../extensions/jqt.listIndex/jqt.listIndex.css";</style>
<script src="../../jqtouch/jquery-1.4.2.js" type="text/javascript" charset="utf-8"></script>
<script src="../../jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script>
<script src="../../extensions/jqt.autotitles.js" type="application/x-javascript" charset="utf-8"></script>
<script src="../../extensions/jqt.listIndex/jqt.listIndex.js" type="application/x-javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var jQT = new $.jQTouch({});
$(function() {
$('#any_id').getCalendar();
});
</script>
<style type="text/css" media="screen">
</style>
</head>
<body>
<div id="jqt">
<div id="home" class="current">
<div class="toolbar">
<h1>Calendar</h1>
</div>
<div id="any_id">
<ul>
<li><time datetime="2011-01-26T14:30Z">210 mg/dl</time></li>
<li><time datetime="2011-01-26T14:30Z">100 mg/dl</time></li>
</ul>
</div>
</div>
</div>
</body>
</html>

my file structure:
...
extensions
images
jqtouch--->includes jqt.icalendar.js that is not working
themes
index.html
jqtouch.css


arv_christos (author) 3 years ago
Thanks for the help.I found the problem.It is a code related problem.I connected my jqtouch files twice
lemonie3 years ago

Something may not be supported, after all it is free.
Assuming that you are doing it right, why are you asking us and not http://members.000webhost.com/login.php?

L
arv_christos (author)  lemonie3 years ago
Because I want a quick answer and the helpline won't reply before 24 hours

OK, I'm not sure without playing with the thing.
However, the error '$('#any_id').getCalendar' [undefined] is not a function seems pretty straightforward. You haven't defined getCalendar, perhaps that is defined somewhere on your local machine, but not on the web-space?

L
arv_christos (author)  lemonie3 years ago
This problem line contains the script of javascript that starts icalendar so it is not so easy for me to make changes. Also, the reference says that you just have to place the script that starts ical. It is really strange because my script works perfectly in local but it cannot run properly in the web.I also tried my script in other web hosting services.

Well if it works on other hosting, I'd go back to my original answer:
Something may not be supported, after all it is free.

Tell us what the helpline said when they get back to you.

L
Jayefuu3 years ago
Having never used javascript I can't be of much help, but here are some suggestions....

- Have you confirmed that the stuff in the jqtouch directory on your server is working correctly? Is there a setup file, example or an admin page within the directory that you can use to verify the installation of it?

- Does javascript have an error reporting function like php does? If you turn that on does your page display any errors? These might help.
arv_christos (author)  Jayefuu3 years ago
Safari web inspector gives me an error.
it says:
TypeError: Result of expression '$('#any_id').getCalendar' [undefined] is not a function.
Does anybody know what that means or how i could make it work?
$(function() {
$('#any_id').getCalendar();
});
.  I haven't used JS in many years, but that line of code looks wonky to me.

.  It might also be caused by not loading in the file that contains the getCalendar functions. See my previous comment.
arv_christos (author)  NachoMahma3 years ago
Yes maybe but if i exclude these lines of code my calendar won't even show up!
. That indicates to me that the file is loading, so, for that file at least, you can forget my comment about bad file paths.

. I'm guessing that you copy/pasted some code and don't fully understand what it does. I'm also guessing that '#any_id' needs to be replaced with, well, some kind of id. Maybe it just needs to be set in one of the other included files. It's really difficult to tell without some idea of what is supposed to happen (or a look at the other code).
NachoMahma3 years ago
.  My first _guess_ is that there is a difference in the directory structures. The script can't find the other files.
.  If possible, turn on debugging messages.
.  As per lemonie, your hosting service should be able to give a better answer.