Passing parameters to a JQuery function

后端 未结 5 694
小鲜肉
小鲜肉 2020-12-04 07:23

I\'m creating HTML with a loop that has a column for Action. That column is a Hyperlink that when the user clicks calls a JavaScript function and passes the parameters...

5条回答
  •  失恋的感觉
    2020-12-04 08:19

    Do you want to pass parameters to another page or to the function only?

    If only the function, you don't need to add the $.ajax() tvanfosson added. Just add your function content instead. Like:

    function DoAction (id, name ) {
        // ...
        // do anything you want here
        alert ("id: "+id+" - name: "+name);
        //...
    }
    

    This will return an alert box with the id and name values.

提交回复
热议问题