brian

brian

  • NA
  • 1
  • 1.1k

retriving data using jquery from a model

Dec 5 2012 4:47 AM
HI

Can anyone advice me on this problem.

i'm creating a tagging system.  in my model (model1) it creates a row of documents by calling another model (model2) ive created a jquery script in modal1 which sets the tag(img) on n off in each row of the document. is there a way i can retrieve the document id from the documents using jquery n updating the documents wth the tags.


model 2
<tr class="flag"><td> <img .....></td><td><%: html.DisplayFor(m=>m.id) %></td></tr>
</td>
       <% if (!Model.IsLoadViaDialog) { %> 
    <td>
        <%: Html.DisplayFor(m=>m.Owner) %>       
    </td>  
        <% } %>  
    <td>
         <%: Html.DisplayFor(m=>m.Date) %>      
    </td>        




model 1

 <tbody class="child" style="display: table-row-group;">             
            <% foreach (var d in Model.Rows)
               { %>
              
                    <%: Html.DisplayFor(m => d, new { divId, parentId = Model.ParentId })%>
           
            <% } %>

        </tbody>

//in my script its smthing like
<script type="text/javascript">

$('.flag').click(function(){

(this).attr.('src',swap);

function swap(){
//code to alternate image;
 return url;
}

});


</script>