SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    adding post to current query

    i have the following
    Code:
    <script type="text/javascript">
    	$(document).ready(function() {
        $("button").click(function(event) {
            alert(event.target.id);
    });
    });
    	  </script>
    This tells me the id of the button that has been pressed.

    how would i add a $post request to index.php?id= with the value of the id?

  2. #2
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    got
    Code:
    	 <script type="text/javascript">
    $(function(){
      $("button").on("click", function(){
        var myId = $(this).attr("id");
    	$.post( "index.php?id="+myId);
      });
    });
    	  </script>
    but i need a way to capture this as $_POST['']; is not

  3. #3
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    fixed but $_POST & $_GET are empty for some silly reason
    Code:
    	 <script type="text/javascript">
    $(function(){
      $("button").on("click", function(){
        var myId = $(this).attr("id");
    	$.post( "index.php?id="myId, {id:myId} );  
      });
    });
    	  </script>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •