Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#mySpecifikButton").click(function()
- {
- ....some code here...
- });
- <p><a id="userID">user 0</a></p>
- <p><a id="userID">user 1</a></p>
- <p><a id="userID">user 2</a></p>
- <p><a id="userID">user 3</a></p>
- ...
- <input type="button" value="Button 1" id="1" />
- <input type="button" value="Button 2" id="2" />
- <input type="button" value="Button 3" id="3" />
- <input type="button" value="Button 4" id="4" />
- <script type="text/javascript">
- $("input[type=button]").click(function() {
- $.post("myPHPscript.php",{buttonID: $(this).attr("id")},function(d) {
- //d is the response from the PHP page.
- //Do something with it!
- });
- });
- </script>
- var xmlHttp;
- ajaxFunction(id){
- url = anypage.php?Sentid=id; // here you are sending id through GET to any simple db connection mysql and php based page to add to db or anyother function.
- xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true) xmlHttp.send(null)
- }//end of function
- function stateChanged(){
- if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete" ){ // any operation you want to perform here
- }//end of if
- }//end of function
- function GetXmlHttpObject(){
- var xmlHttp =null;
- var xmlHttp =null;
- if (window.XMLHttpRequest){
- // If IE7, Mozilla, Safari, etc: Use native object
- var xmlHttp = new XMLHttpRequest()
- }
- else {
- if (window.ActiveXObject){
- // ...otherwise, use the ActiveX control for IE5.x and IE6
- var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- }
- return xmlHttp;
- }//end of function
- <?php
- some_insert_function($_REQUEST["userid"], ...);
- ?>
- function go(el) {
- $.post("/insert.php?items="+el.id);
- }
Add Comment
Please, Sign In to add comment