title: how to update records into mysql database using jquery?
body: <p>I have a userdetails table in mysql database into which i have inserted records onsubmit using jquery.(user_id , name , age , phone , email , text)
  Now the same records can be viewed in a list using jquery in a html page , when i click on user_id ("1" which i have made as a href) , so when i click on 1 , the details which 1 contains which will be viewed in my user_details.html page like</p>
  
  <p><a href="http://localhost:8082/JqueryForm/html/user_details.html?user_id=1" rel="nofollow">http://localhost:8082/JqueryForm/html/user_details.html?user_id=1</a></p>
  
  <p>Name : abc ----------> textarea in my html page</p>
  
  <p>Phone : 1000000</p>
  
  <p>email : abc@gmail.com</p>
  
  <p>age : 20</p>
  
  <p>text : abcdefghij </p>
  
  <p>Now when my user_details.html opens with the details of a particular user only , i can edit the values as it is a textarea and update the values in my database for the same user_id , with the help of a update button</p>
  
  <p>I have written a update query</p>
  
  <pre><code>public void update_UserDetails(int user_id ,String user_name, String age, 
          String mobile_no, String email_id,
          String ck_text) {
      try {
          prep = (PreparedStatement) connection
                  .prepareStatement("update user_details set 
          user_name=?,user_age=?,mobile_no=?,email_id=?,ck_text=? where 
          user_id=?");
          prep.setInt(1, user_id);
          prep.setString(2, user_name);
          prep.setString(3, age);
          prep.setString(4, mobile_no);
          prep.setString(5, email_id);
          prep.setString(6, ck_text);
          prep.executeUpdate();
      } catch (SQLException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>and called the method in my user_details.jsp page</p>
  
  <pre><code>&lt;%
      Sql_Server server = new Sql_Server();
      String name = request.getParameter("name");
      String age = request.getParameter("age");
      String email = request.getParameter("email");
      String phone = request.getParameter("phone");
      String ck_text = request.getParameter("ck_text");
      String user_id = request.getParameter("user_id");
      int userid = Integer.parseInt(user_id);
      server.update_UserDetails(userid,name, age, phone, email,ck_text);
  %&gt;
  </code></pre>
  
  <p>Now when i am calling the jsp page in my jquery , the values are not getting updated , can anyone help me to understand why isnt the values getting updated ?</p>
  
  <pre><code>$(document).ready(function(){
      $("#update").click(function(e) {
          var name = $("#nametext").val();
          var age = $("#agetext").val();
          var email = $("#emailtext").val();
          var phone = $("#phonetext").val();
          var ck_text = $("#textarea").val();
          var dataString = '&amp;name=' + name + '&amp;age=' + age + '&amp;email=' + email + '&amp;phone=' + phone + '&amp;ck_text=' + ck_text;
  
              $.ajax({
                  type : "POST",
                  url : 
               "http://localhost:8082/JqueryForm/html/jsp/update_userdetails.jsp",
                  data : dataString,
                  cache : false,
                  success : function(result) {
                           alert("Records Updated Successfully");
                           }
              });
          return false;
      });
  });
  </code></pre>