Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var x = 1;
  2.     function getSupplier( manID ){
  3.         new Ajax.Request("addField.php",
  4.                     {
  5.                     method: 'post',
  6.                     postBody: 'manID='+ manID,
  7.                                         onSuccess: function(transport){
  8.                                                 var response = transport.responseText || "no response text";
  9.                                                 alert("Success! \n\n" + response);
  10.                                         },
  11.  
  12.                     });
  13.         }
  14.         function addInput(){
  15.         x++;
  16.             manID = document.getElementById("manID").value
  17.             getSupplier( manID );
  18.             eDIV = document.createElement("div");
  19.             eDIV2 = document.createElement("div");
  20.             eDIV.setAttribute("id","fieldWrapper");
  21.             eDIV2.setAttribute("id","inputDesc");                              
  22.             eAnchor = document.createElement("input");                          //create the input box
  23.             eAnchor.setAttribute("type", "text");                                           //assign the input box a type
  24.             eAnchor.setAttribute("value", getSupplier.responseText);
  25.             eAnchor.setAttribute("name", "discount" + x);               //asign a reference to the input box
  26.             eDIV.appendChild(eAnchor);                                                          //append the input to the div
  27.             document.getElementById("fields").appendChild(eDIV);        //insert the new div into existing one
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement