tags:

views:

71

answers:

3

hi , i have forms createds that require a value , as this this forms edits different users. so how would i send that value from jquery? i know how to do it with combobox , but i want to do it from links :

like - name [details] when someone clicks on details the forms will pop up, so i wana mimic index.php?id=2 but with jquery, anyideas?

A: 

Do you want to display some content via JQuery with a link? Modify the selector to point to the correct DOM object, eg. an anchor tag with class "details"

$('a .details').click(function ()
{
  $.get(
    'index.php?id=2',
    function(html)
    {
      $('#results').html(html);
    });
});

if you want to load the content the link is pointing to, use (untested)

$('a .details').click(function ()
{
  var anchor = this;
  $.get(
    $(anchor).attr('href'),
    function(html)
    {
      $('#results').html(html);
    });
});
A: 

$('a .details').click(function ()

{ $.get( 'index.php?id=2', <--------------I need to pass that id=2 from a link thats created dynamicaly.

function(html)

{ $('#results').html(html); });});

for example, using a

i can acces , "cat" through jquery, loop through the cat elements and each li id= will be clickable with some css

I cant figure out how to do it with normal text links! thanks anyway dspinozzi

A: 

if the id is stored in the li element, you can get the "id" attribute by using:

$('li').attr('id');