Changing the data in before submit

前端 未结 1 1649
说谎
说谎 2021-01-17 12:38

I am using the ajaxForm plugin found here

Now i have a form with username & password

My requirement is

相关标签:
1条回答
  • 2021-01-17 13:00

    You need to change your beforeSubmit function to this:

        beforeSubmit : function(arr, $form, options){
          arr.push({name:'hashed-password', value:$.md5($('#password').val())})
       },
    

    Then you can access the hashed-password variable in your servlet.

    The reason for this is that the value from the text input has already been processed by AjaxForm and stored in the arr array.

    Edit: if you don't want to send the plaintext password, you can use your original method but change beforeSubmit : function(arr, $form, options){ to beforeSerialize : function() {

    0 讨论(0)
提交回复
热议问题