java - Trying to get some kind of dynamic, unordered list to send the order to servlet -


i'm total programming rookie , can't jsp send servlet. i'm pretty sure servlet's ok have no idea submit button in asp trying send it. looks this:

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui sortable - drop placeholder</title> <link rel="stylesheet"     href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <style> #sortable {     list-style-type: none;     margin: 0;     padding: 0;     width: 60%; }  #sortable li {     margin: 0 5px 5px 5px;     padding: 5px;     font-size: 1.2em;     height: 1.5em; }  html>body #sortable li {     height: 1.5em;     line-height: 1.2em; }  .ui-state-highlight {     height: 1.5em;     line-height: 1.2em; } </style> <script> var sortablelinks = $("#sortable"); var linkorderdata = $(sortablelinks).sortable('serialize'); var formdata =new formdata($(this)[0]);  $( document ).ready(function() {       $('form').on('submit', function (event) {          event.preventdefault();            $.ajax({     url: 'sortcv',     type: 'post',     data: formdata,     async: false,     cache: false,     contenttype: false,     processdata: false,     success: function (returndata) {       alert(returndata);   }    });      return false;   });       $( "#sortable" ).sortable({           placeholder: "ui-state-highlight"         });         $( "#sortable" ).disableselection();       });      </script> </head> <body>     <form role="form" id="data">         <ul id="sortable">             <li id="1" value ="one" class="ui-state-default">cv1</li>             <li id="2" value ="two" class="ui-state-default">cv2</li>             <li id="3" value ="three" class="ui-state-default">cv3</li>         </ul>         <input type = "submit" value="sortcv" name = "sortcv"/>     </form>   </body> 

you're not sending data server. data should explicitly set in <input> fields , known name attribute:

<form role="form" id="data">     <ul id="sortable">         <li id="1" value ="one" class="ui-state-default">cv1</li>         <li id="2" value ="two" class="ui-state-default">cv2</li>         <li id="3" value ="three" class="ui-state-default">cv3</li>     </ul>     <input type="text" name="one" value="one" />     <input type="text" name="two" value="two" />     <input type="text" name="three" value="three" />     <input type = "submit" value="sortcv" name = "sortcv"/> </form> 

note <ul> data not sent server because not user input component.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -