jQuery Ajax call for buttons on a list

Posted by lloydphillips on Stack Overflow See other posts from Stack Overflow or by lloydphillips
Published on 2009-10-18T04:09:25Z Indexed on 2010/04/08 11:03 UTC
Read the original article Hit count: 226

Filed under:
|
|
|
|

I have a list of data that i have in a view from an asp.net mvc application. It's a list of stock and I have two images (a plus and a minus) on the end of each row which will allow me to increase or decrease stock quantity. It works fine at present with a call to the mvc action but since the list is long I want to use jQuery and AJAX to have the call go without a refresh. I want to do this with unobtrusive javascript so don't want onclick handlers on my images. Since I'm just starting out with jQuery I have no idea how I can iterate all the images and add the function. Here are the images with the form tags as they stand:

<td>
            <% using (Html.BeginForm("Increase", "Stock", new { Id = item.StockId }))
               {%>
            <input type="image" src="/Content/Images/bullet_add.png" style="margin-left:20px;" />  <% } %>
             </td>
        <td><% using (Html.BeginForm("Decrease", "Stock", new { Id = item.StockId }))
               {%>
            <input type="image" src="/Content/Images/bullet_delete.png" style="margin-left:10px;" /><% } %>
        </td>

Can anyone help me out a little?

Many thanks.

Lloyd

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about mvc