how to determine the is in which the user clicked on with jQuery?
Hi again
I have list of link
<a href="?id=1" class="test">enable user 1</a>
<a href="?id=2" class="test">enable user 2</a>
<a href="?id=3" class="test">enable user 3</a>
<a href="?id=4" class="test">enable user 4</a>
when I user click a link I create a dialog box using jQuery UI
like so
- <script>
- $(function($){
- $( "#dialog-confirm" ).dialog({
- resizable: false,
- height:175,
- modal: true,
- autoOpen: false,
- buttons: {
- "Yes I am sure. Process": function(e) {
- console.log($.urlParam('url')); //I need to know the id here
- $( this ).dialog( "close" );
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- }
- });
-
-
- $('.decative').click(function(e) {
- $( "#dialog-confirm" ).dialog( "open" );
- e.preventDefault();
- });
-
- });
-
-
- </script>
i found this function to return the value of id
- $.urlParam = function(name){
- var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
- return results[1] || 0;
- }
-
Now, I just need to be able to tell what link did the user clicked on?
so if a user click on "enable user 1" I can send a json call to enable user.
I just need to be able to determine the URL id in line 10 of my code.
How can I do this?
Thanks