jquery - Can't send the target ID from a view to the controller "ondrop" event -
i using c# mvc 4 , trying drop text img class , send img id controller :
<img ... ondrop="drop(this,event);"> function drag(target, e) { e.datatransfer.setdata('text', target.id); } function drop(target, e) { var id = e.datatransfer.getdata('text'); target.appendchild(document.getelementbyid(id)); e.preventdefault(); $.ajax({ url: '@url.action("myaction")', type: 'post', data: { imgid: target.id }, }); }
and
public actionresult addfriendtovirtualfriend(string imgid) { ... }
the string sent controller empty.
what doing wrong?
Comments
Post a Comment