Jump to content

Working with PHP + Javscript


ueon

Recommended Posts

Another option is to use Javascript to set the value of a named formfield in a function...:

 

function setValue(){
.
.
document.getElementById('formfield').value = your_value;
.
.
}

 

and in your form:

 

.
<input type="text" id="firstfield" onchange="setValue()" />
.
.
<input type="text" id="formfield" value="" />
.

or...... you could use javascript to load a hidden Iframe and pass your vars to the iframe behind the scenes via _GET if not sensitive data... or just encrypt it first

 

for what your talking about tho you are probably better off with ajax.. its really not that difficult. if you already know javascript.

I actually know for a fact that facebook uses php for its commenting system =/ so it must mean that javascript is able to integrate with php

 

Uh... that's what AJAX is.  AJAX is JavaScript which sends requests to the back end.  The back end sends a response back to the JavaScript.  The JavaScript then inserts the response into the current page in real time.

I actually know for a fact that facebook uses php for its commenting system =/ so it must mean that javascript is able to integrate with php

 

Uh... that's what AJAX is.  AJAX is JavaScript which sends requests to the back end.  The back end sends a response back to the JavaScript.  The JavaScript then inserts the response into the current page in real time.

 

Yes, i know AJAX is capable of doing what I described. but I'd definitely like to know if anyone here know how to do the same thing with php?

I actually know for a fact that facebook uses php for its commenting system =/ so it must mean that javascript is able to integrate with php

 

Uh... that's what AJAX is.  AJAX is JavaScript which sends requests to the back end.  The back end sends a response back to the JavaScript.  The JavaScript then inserts the response into the current page in real time.

 

Yes, i know AJAX is capable of doing what I described. but I'd definitely like to know if anyone here know how to do the same thing with php?

 

AJAX uses PHP (or some other server-side language). I don't think you know what AJAX is.

Ultimately, if you want the experience to be seamless, with no page refresh, you'll need to use JavaScript.  Why?  Because PHP exists only on the server, and has finished executing commands by the time a web page hits your screen.  Because of those two things, it can't respond to client side actions.  That's why PHP, by itself, always requires a page refresh.

 

Also, try interacting with Facebook with JavaScript turned off.  You may be in for a surprise.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.