Quote:
Originally Posted by devnull69
I think I have a slight idea about what your problem MIGHT be ... because there are a lot of people out there that have problems with that
So I give you a short outline of the general client/server architecture with PHP/HTML/Javascript
Browser request
1. You enter a URL into the address bar. Let's say it's going to an index.php with a single parameter index.php?value=5
2. The server will receive the request, look for index.php and execute it (if found). The parameter will then be available inside the PHP script as $_GET["value"]
3. The script will output some "stuff". Usually this is HTML (plus Javascript). The web server sends the output to the browser. The PHP script terminates(!)
4. The browser engine reads the response from the server and builds an internal representation as a tree ... the so called DOM. The rendering engine traverses the tree and renders all the elements. They become visible (if set to "visible" of course) in the browser
5. Javascript code that is embedded into the server response or has to be read from an external source will be executed (sometimes immediately, sometimes only after some user interaction).
6. Sometimes the Javascript code wants to load additional external content. It does that by initiating a request to a server side script. It's mostly the same as in (1), but it happens in the "background" without the browser refreshing the page. This is called an AJAX request. Now steps (2) and (3) execute mostly the same way as before.
7. The output of the script will be available for Javascript on the current page (still without any page refresh). So it's still the code from (5) that is running. The response from the new script can now be embedded into the existing DOM. So it will be made visible.
PHP and Javascript are not "directly" connected. You can neither read PHP variables from Javascript nor Javascript variables from PHP without sending and receiving requests!
|
Arh. That actually makes sense. Thanks a lot! I understand how AJAX works now.
Although, I still can't seem to work on my page. So, I will start from scratch:
Here is my script:
Code:
$(document).ready(function(){
$(".open").colorbox({
width:"50%",
inline:true,
href:"#inline_example1"
});
});
How shall the above code look, if I wish to get ($_GET) a value from my url? (topic.php?id=1"e=2) - in this case, I need to have the quote value
And how shall the URL to start the JS function look like?
The textareas ID is
id="replyText".