post json - newbie question

post json - newbie question

Hi,


basic newbie question... I have a button with id =  postJson that triggers a script (below)...

- the button is on top of the form
- now I would like to add a duplicate 2nd button at the bottom of the form that does the same thing - so I duplicated the button and gave it id =  postJson2 ... 

Q: rather than create a whole dupe of the script (to trigger the same thing) - is there a way to write it so that the script below will trigger from either button =  postJson  or  postJson2?

maybe like :  $('#postJson').click(function() or ????  $('#postJson2').click(function()  { ?????

- or maybe an easier way to have either button trigger the same script?




  1. <script>
    $(document).ready(function(){

    $('#postJson').click(function(){

    etc....