Got two questions:
How can i intgrate a php script to a html document that:
-
should do his work at the documents startup and return a integer, which can be handled by javascript?
-
should do his work after a link is clicked and uses the links id?
lets create a example project:
1. php-name: start.php
2. php-name: click.php
html-code:
<!doctype html>
<html>
<head>
<title>test</title>
<script type="text/javascript">
$(document).ready(function(){
});
</head>
<body>
<p><a class="links" id="l1" href="http://www.google.com/">Boerse</a></p>
<p><a class="links" id="l2" href="http://www.google.ch/">My Gully</a></p>
</body>
</html>
1. With javascript you could use jquery to perform a
POST HTTP Requestthat simply posts something like ‘BeenSent’ with data = 1. Then php checks to see if that isset. If it is then send back the variable to jquery as the function at the end of the ajax() method.Here’s an example
2.
For the links you could simply perform a
GETHTTP Request, or you could simply define the element’s id within the link… like so…Hope this helped! 🙂