You are not logged in.

#1 2018-11-13 11:26:49

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Javascript

I am trying to get a certain script that runs off javascript to work on my site but it wont work, is there anything I need to install to get it working?
I will post the URL to a stack overflow post I posted, but have not got a response, so thought I would come here and ask.

Any help is appreciated, thank you!

Stack Overflow post

Offline

#2 2018-11-13 13:41:39

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 520

Re: Javascript

^Of course you have received no response.
Basically, you blurted several tens of undocumented code (PHP mixed with JavaScript), gave no detailed explanation what it should do, and basically showed that you have done nothing to try to debug it yourself.

You say, the javascript code doesn't work ... did you try creating minimal javascript code (doing something trivial), which will show that javascript does/doesn't work? Did you try to inspect various variables in javascript to see if you get expected values?

Did you install and enable PHP on your web server? Can you prove it works or it doesn't work?

Your code presumes there is a certain database and several other php scripts (via 'includes'). How on the earth should anyone try your code without all requirements?

In my experience, people (including myself) are reluctant to inspect and debug long (snippets of) unknown code, without enough background information and very precise statement like 'this line in code should do that-and-that, bit it doesn't' or similar (basically showing that you yourself have already tried to find what is wrong, and showing that you yourself understand what code does).

----------------------------------------------------------------------------------------

Having said that, generally I would check:
- check that PHP works, via simple script (for example: '<?php phpinfo(); ?>')
- if you have the database (MySQL) software installed on web server, and if it is functioning correctly, and if required database exists and you if can connect to it with PHP
- check that javascript works, also by some minimal example (I don't know javascript, but anyway it is executed on client's computer, not on the server)
If everything of above works, then it is time to debug your code. If you understand the code (I don't), then check values of variables, see if code - line by line - does what you expect it does ... and so on. That's what is called debugging the code.

Last edited by iMBeCil (2018-11-13 13:43:36)


Postpone all your duties; if you die, you won't have to do them ..

Online

#3 2018-11-14 02:18:57

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Re: Javascript

iMBeCil wrote:

^Of course you have received no response.
Basically, you blurted several tens of undocumented code (PHP mixed with JavaScript), gave no detailed explanation what it should do, and basically showed that you have done nothing to try to debug it yourself.

You say, the javascript code doesn't work ... did you try creating minimal javascript code (doing something trivial), which will show that javascript does/doesn't work? Did you try to inspect various variables in javascript to see if you get expected values?

Did you install and enable PHP on your web server? Can you prove it works or it doesn't work?

Your code presumes there is a certain database and several other php scripts (via 'includes'). How on the earth should anyone try your code without all requirements?

In my experience, people (including myself) are reluctant to inspect and debug long (snippets of) unknown code, without enough background information and very precise statement like 'this line in code should do that-and-that, bit it doesn't' or similar (basically showing that you yourself have already tried to find what is wrong, and showing that you yourself understand what code does).

----------------------------------------------------------------------------------------

Having said that, generally I would check:
- check that PHP works, via simple script (for example: '<?php phpinfo(); ?>')
- if you have the database (MySQL) software installed on web server, and if it is functioning correctly, and if required database exists and you if can connect to it with PHP
- check that javascript works, also by some minimal example (I don't know javascript, but anyway it is executed on client's computer, not on the server)
If everything of above works, then it is time to debug your code. If you understand the code (I don't), then check values of variables, see if code - line by line - does what you expect it does ... and so on. That's what is called debugging the code.

Okay so its a chat bar for the bottom of each page all executed via style_bottom.php I did not do this code so I am just as confused as you are, I have tried another javascript code and that worked.
I am running php 5.6 and mysql is all running correctly.
The only issue I am having is with the chat system, I have never had an issue with it running until I started using my pc as a hosting machine.
I havent changed anything within the code.
Basically, theres a few chat bars that should appear at the bottom of each page, when clicked it will slide up from the bottom and it will display all previous posted messages and give you a text field to be able to post another message, and now the bars won't even appear at the bottom of the page, and I just can't seem to figure out what the issue is.

Offline

#4 2018-11-14 07:14:41

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 520

Re: Javascript

^Sorry, don't have knowledge no time to debug this code. Since you haven't written this, perhaps you should ask person (or people) who actually wrote code why it doesn't work.

Good luck with your web site  wink


Postpone all your duties; if you die, you won't have to do them ..

Online

#5 2018-11-14 07:21:40

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Re: Javascript

iMBeCil wrote:

^Sorry, don't have knowledge no time to debug this code. Since you haven't written this, perhaps you should ask person (or people) who actually wrote code why it doesn't work.

Good luck with your web site  wink

Haha that's the issue I can't get hold of them..
It'd have to be something to do with the server is all I can think..
Is there anything you can think of that I should install to see if it eliminates the problem..

Offline

#6 2018-11-14 07:43:47

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 520

Re: Javascript

^Really sorry, but I don't speak javascript (and have no time to learn it now). I'm afraid you are on your own  neutral

As I said, the javascript is executed on client's side, which means that person who opens the web page will get executed javascript on his own computer. In this respect, I doubt that anything else has to be installed. That is: if really javascript doesn't work.

Only thing I can think of is whether the client's web browser forbid execution of the javascript code via some plugin. I suppose you are the client ... check if 'nojavascript' (or similar) plugin is active in your browser.


Postpone all your duties; if you die, you won't have to do them ..

Online

#7 2018-11-14 11:51:43

doxanthropos
Member
Registered: 2016-01-26
Posts: 26
Website

Re: Javascript

What you could do to make it a little more plausible for people to help you with this:

Try some basic debugging steps first and give us ( and the people at SO ) the outcome, preferable in some usable form (error messages and something similar).

Some example steps that might help you gain more information, which in turn might give the people reading this even a clue as to what is happening with your site. These steps might give you different results in different browsers, so I would advise to run through them at least with Google Chrome and Firefox:

Open the website in your browser:

  • Do you see the website at all?

  • What is missing, what not?

Open the console of your browser (usually done by opening the developer tools with F12 and then opening the tab called "Console").

  • Are there error messages? If so, they might hold relevant information.

Open the website with "View Source" or "View Page Source"

  • Is the output from the PHP script there?

  • Is the JavaScript there?

  • If there is JavaScript loaded from somewhere else (via a script tag that has a src attribute) can you reach it by clicking the address?


With the information you gave here, these are all shots in the dark, aimed not at solving the problem, but at trying to shine at least a little light on it to maybe see what it might be.

Offline

#8 2018-11-14 12:59:52

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 520

Re: Javascript

^ +1000


Postpone all your duties; if you die, you won't have to do them ..

Online

#9 2018-11-14 14:23:38

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Re: Javascript

doxanthropos wrote:

What you could do to make it a little more plausible for people to help you with this:

Try some basic debugging steps first and give us ( and the people at SO ) the outcome, preferable in some usable form (error messages and something similar).

Some example steps that might help you gain more information, which in turn might give the people reading this even a clue as to what is happening with your site. These steps might give you different results in different browsers, so I would advise to run through them at least with Google Chrome and Firefox:

Open the website in your browser:

  • Do you see the website at all?

  • What is missing, what not?

Open the console of your browser (usually done by opening the developer tools with F12 and then opening the tab called "Console").

  • Are there error messages? If so, they might hold relevant information.

Open the website with "View Source" or "View Page Source"

  • Is the output from the PHP script there?

  • Is the JavaScript there?

  • If there is JavaScript loaded from somewhere else (via a script tag that has a src attribute) can you reach it by clicking the address?


With the information you gave here, these are all shots in the dark, aimed not at solving the problem, but at trying to shine at least a little light on it to maybe see what it might be.

I cant see the output for the php of the chat script no.
There is other scripts there that I click on the link and it will take me to a page with all the code to that specific javascript file..

I will check the console for errors later..

Offline

#10 2018-11-14 19:53:53

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,228

Re: Javascript

When you develop JS, you must use the developer tools (F12), esp. the console tab for errors, and possibly the other tabs, esp. the network tab to see what the browser is actually requesting/sending. Do this before trying anything else; this is always the first step to take when doing webdev and everything else is just a waste of time.


Im grünen Wald, dort wo die Drossel singt…

Offline

#11 2018-11-14 20:37:36

cloverskull
Member
Registered: 2015-10-01
Posts: 301

Re: Javascript

Might I suggest not hosting this type of thing yourself inside of your own firewall?

My concern is that your level of exposure to attack and compromise is quite high when you open up your internal network to incoming requests from the external internet, and if you're a bit inexperienced with web dev or troubleshooting, the risk factor is orders of magnitude higher. You can get very cheap hosting on a VM somewhere.

Offline

#12 2018-11-14 20:39:39

cloverskull
Member
Registered: 2015-10-01
Posts: 301

Re: Javascript

Also - how can anyone be expected to help diagnose without any error messages or logs or anything?

Offline

#13 2018-11-15 12:19:27

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Re: Javascript

twoion wrote:

When you develop JS, you must use the developer tools (F12), esp. the console tab for errors, and possibly the other tabs, esp. the network tab to see what the browser is actually requesting/sending. Do this before trying anything else; this is always the first step to take when doing webdev and everything else is just a waste of time.

This is one of the errors I am getting
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /index.php line 1230 &gt; eval was not found on this server.</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at criminal-city.com Port 80</address>
</body></html>

Offline

#14 2018-11-15 13:08:07

earlybird
ほやほや
Registered: 2015-12-16
Posts: 605
Website

Re: Javascript

bjmag94 wrote:
twoion wrote:

When you develop JS, you must use the developer tools (F12), esp. the console tab for errors, and possibly the other tabs, esp. the network tab to see what the browser is actually requesting/sending. Do this before trying anything else; this is always the first step to take when doing webdev and everything else is just a waste of time.

This is one of the errors I am getting
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /index.php line 1230 &gt; eval was not found on this server.</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at criminal-city.com Port 80</address>
</body></html>

…that's a 'simple' server error and has nothing to do with JavaScript or in-browser issues.  I'd say you need to look into /var/log/apache2/{access*,error*}.log and /etc/apache2 to figure out wherein the error lies, and make Apache look at the correct place for the URL you're submitting to it. It's a matter of telling the web server which file or content to return for the given URL. You probably need to set the site's root directory correctly. <Directory> and <DocumentRoot> seem to be the configuration objects to look into.

I suggest you read through the Users' Guide here: https://httpd.apache.org/docs/current/index.html to understand how to make the program do what you need, esp. https://httpd.apache.org/docs/current/sections.html.

All the software you're using has pretty good documentation. There's homework involved, but that's the cost you pay for using free software.

Offline

#15 2018-11-15 23:39:51

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 34

Re: Javascript

bjmag94 wrote:

Haha that's the issue I can't get hold of them..

The author is not so difficult to find.

Open a terminal and issue:

 whois vnmzone.com
bjmag94 wrote:

It'd have to be something to do with the server is all I can think..
Is there anything you can think of that I should install to see if it eliminates the problem..

If you are realy going forward and making it publicly available you should upgrade OS to Debian 9/BL Helium.


// Regards rbh

Offline

#16 2018-11-17 03:46:34

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Re: Javascript

rbh wrote:
bjmag94 wrote:

Haha that's the issue I can't get hold of them..

The author is not so difficult to find.

Open a terminal and issue:

 whois vnmzone.com
bjmag94 wrote:

It'd have to be something to do with the server is all I can think..
Is there anything you can think of that I should install to see if it eliminates the problem..

If you are realy going forward and making it publicly available you should upgrade OS to Debian 9/BL Helium.

Thank you.
Without a fresh install how would I upgrade the OS?

Offline

#17 2018-11-17 04:11:34

damo
....moderator....
Registered: 2015-08-20
Posts: 4,378

Re: Javascript

^ I don't think you have told us yet what release you have installed?


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#18 2018-11-17 07:03:43

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Re: Javascript

damo wrote:

^ I don't think you have told us yet what release you have installed?

Yeah I said I'm running debian 8.
And BunsenLabs GNU/Linux 8.9 (Hydrogen)

Offline

#19 2018-11-17 07:54:08

cloverskull
Member
Registered: 2015-10-01
Posts: 301

Re: Javascript

Have you tried searching for how to upgrade your debian OS?

smile

Offline

#20 2018-11-17 13:54:52

damo
....moderator....
Registered: 2015-08-20
Posts: 4,378

Re: Javascript

cloverskull wrote:

Have you tried searching for how to upgrade your debian OS?

smile

For example, there is a Search facility in the top bar at the top of this page hmm


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#21 2018-11-21 03:20:04

bjmag94
Member
Registered: 2017-11-01
Posts: 42

Re: Javascript

damo wrote:
cloverskull wrote:

Have you tried searching for how to upgrade your debian OS?

smile

For example, there is a Search facility in the top bar at the top of this page hmm

Upgraded to Helium, done a clean install, now I have it all set up and running except for php5, which I can't remember how to install haha..
As my site is not updated enough to be ran with php7

Offline

Board footer

Powered by FluxBB