Hi,

My problem with JQuery (and JS in general) is that I do not know how
to pass dynamic data to a function.

I have a .click function that is assigned to a link. Here's the code:


$(document).ready(function() {
                $("a.youtube").click(function() {
                          $.ajax({
                         type: "POST",
                         url: "ajaxtest.php",
                         data: "player=youtube&id=1",
                         success: function(msg){
                         $("div.player").append("Loaded" + msg);
                                      }
                                    });
                });
         });



The problem is that I need to pass dynamic data with it, but the
function's code is in an external JS script included in the HEAD area
of my main script. Which means the line ' data: "player=youtube&id=1"
' is basicly hardcoded.

And more: using AJAX, a click on the link creates some new links, that
each needs to be connected to its own .click function with individual
data.

How can I achieve this? From a programming logic point of view?


Regards,

Michael



Reply via email to