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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -