Be a Supporter!

Javascript messing with PHP

  • 377 Views
  • 12 Replies
New Topic Respond to this Topic
Boltrig
Boltrig
  • Member since: Mar. 17, 2006
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Javascript messing with PHP 2007-05-06 17:58:42 Reply

Is it common that javascript messes with PHP?

Ive been trying to put bidvertiser ads onto my site, but whenever I do it moves my PHP shoutbox to wherever the javascript is, and puts the ads onto the PHP script location!

Any ideas on how to resolve this?

Thanks in advance guys

Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Javascript messing with PHP 2007-05-06 18:00:14 Reply

If you post what it looks like before, after and the code, then someone can probably help you out, other than that it's difficult to give you an answer.

Boltrig
Boltrig
  • Member since: Mar. 17, 2006
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to Javascript messing with PHP 2007-05-06 18:15:07 Reply

Umm, it seems to have straigtened itself out.

Not sure what caused it. But still, just as a theoretical - does javascript tend to bugger up other scripting languages?

DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Javascript messing with PHP 2007-05-06 18:16:16 Reply

At 5/6/07 06:15 PM, Boltrig wrote: Not sure what caused it. But still, just as a theoretical - does javascript tend to bugger up other scripting languages?

JavaScript can never touch actual PHP.

The only thing JavaScript can do is output stuff that can change the position of things on the page, or change HTML


BBS Signature
cherries
cherries
  • Member since: Jun. 7, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Javascript messing with PHP 2007-05-06 22:13:56 Reply

At 5/6/07 06:16 PM, DFox wrote: The only thing JavaScript can do is output stuff that can change the position of things on the page, or change HTML

Are you for serious? Or just don't know much javascript?

gnatinator
gnatinator
  • Member since: Sep. 12, 2005
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to Javascript messing with PHP 2007-05-06 22:23:41 Reply

DFox is right.

Javascript is client side, PHP is server side, they never directly interact with each other.

Although the text PHP produces could certainly interact with the javascript


Canadian LAN Party Community! OH YEAH.

BBS Signature
DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Javascript messing with PHP 2007-05-06 22:25:44 Reply

At 5/6/07 10:13 PM, cherries wrote: Are you for serious? Or just don't know much javascript?

Huh?

I hope you don't actually think JavaScript can modify PHP... JavaScript is a client side language. PHP is server side. Unless you've invented a new kind of JavaScript that runs server side then there's no way...

At 5/6/07 10:23 PM, gnatinator wrote: Javascript is client side, PHP is server side, they never directly interact with each other.

Xactly.

Although the text PHP produces could certainly interact with the javascript

But at that point it's not PHP, it's HTML :)


BBS Signature
different
different
  • Member since: Jul. 8, 2004
  • Offline.
Forum Stats
Member
Level 35
Blank Slate
Response to Javascript messing with PHP 2007-05-07 08:38:02 Reply

At 5/6/07 10:25 PM, DFox wrote: I hope you don't actually think JavaScript can modify PHP... JavaScript is a client side language. PHP is server side. Unless you've invented a new kind of JavaScript that runs server side then there's no way...

Javascript can interact with the server, it's all these fancy new AJAX tricks... I don't know much about it, but it is possible. Google Chat uses JS for such a thing.


> twitter.

elbekko
elbekko
  • Member since: Jul. 23, 2004
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to Javascript messing with PHP 2007-05-07 10:27:18 Reply

Erm, unless your div or whatever has the same class/id as the ads you were inserting, JS couldn't have done anything to it. No, not even with AJAX.


"My software never has bugs. It just develops random features. " - Unknown

[ FluxBB developer | Quickmarks 0.5.1 | Strings & Ints - my blog ]

BBS Signature
different
different
  • Member since: Jul. 8, 2004
  • Offline.
Forum Stats
Member
Level 35
Blank Slate
Response to Javascript messing with PHP 2007-05-07 10:29:14 Reply

At 5/7/07 10:27 AM, elbekko wrote: Erm, unless your div or whatever has the same class/id as the ads you were inserting, JS couldn't have done anything to it. No, not even with AJAX.

True. But I was talking about javascript having some server side operations, not that JS could manipulate PHP. JS can manipulate the output of PHP though.


> twitter.

elbekko
elbekko
  • Member since: Jul. 23, 2004
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to Javascript messing with PHP 2007-05-07 10:30:35 Reply

Yes, but not the output of the page you're on (unless you want some fancy infinity looping ;)).


"My software never has bugs. It just develops random features. " - Unknown

[ FluxBB developer | Quickmarks 0.5.1 | Strings & Ints - my blog ]

BBS Signature
DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Javascript messing with PHP 2007-05-07 13:12:13 Reply

At 5/7/07 08:38 AM, different wrote: Javascript can interact with the server, it's all these fancy new AJAX tricks... I don't know much about it, but it is possible. Google Chat uses JS for such a thing.

JavaScript can't interact with the server. With AJAX, JavaScript CALLS a PHP or server-side script just like the browser would...

So the AJAX calls the PHP script which simply outputs text that is interpreted by the client side browser. They never physicaly interact. It's input from browser -> POST or GET to server side script -> output from PHP script as HTML or text.


BBS Signature
Pilot-Doofy
Pilot-Doofy
  • Member since: Sep. 13, 2003
  • Offline.
Forum Stats
Member
Level 37
Musician
Response to Javascript messing with PHP 2007-05-07 20:04:24 Reply

At 5/7/07 01:12 PM, DFox wrote:
At 5/7/07 08:38 AM, different wrote: Javascript can interact with the server, it's all these fancy new AJAX tricks... I don't know much about it, but it is possible. Google Chat uses JS for such a thing.
JavaScript can't interact with the server. With AJAX, JavaScript CALLS a PHP or server-side script just like the browser would...

So the AJAX calls the PHP script which simply outputs text that is interpreted by the client side browser. They never physicaly interact. It's input from browser -> POST or GET to server side script -> output from PHP script as HTML or text.

Correct. I think most people fail to understand that Javascript is a part of your browser. It's good to think of it that way because then it's easy to see what Javascrpt can and cannot do. Thinking of it like this can answer a lot of questions plain and simple, with no fuzzy areas.

For instance, Javascript never interacts with PHP, period. Javascript sends a call to the browser to read a URL, that's all. All of the XMLHTTP stuff is just to create a variable and store it's value.

Think of it like this:

Your browser is the parent and Javascript is the child who has to ask the parent (browser) to do everything. Javascript is a pussy.