Passing params to jQuery function from html code

Passing params to jQuery function from html code

Hi,

I want to do something like below with jQuery

<a id="nextId" href="javascript:doSomething('http://some_dynamically_created_link_through_velocity')>NextPage</a>

<script>
function doSomething(link){
  //process the response
}
</script>

Right now my code block with jQuery looks like this :
<a id="nextId" href="javascript:doSomething('http://some_dynamically_created_link_through_velocity')>NextPage</a>

<script>
function doSomething(link){
  $("#nextId").click(function()  {  $('div.galleryDiv').html("loading....").load(link);   })
}
</script>
The problem with the above code is that I have to click twice to invoke the link - obviously, one for Javascript and the other jQuery 'click' fucntion.

I am new to jQuery, can you please show me the correct solution for the above scenario - invoking jQuery 'click', from HTML code, by passing dynamically generated 'link' as param

Thanks,
RajeshK