search

Home  >  Q&A  >  body text

javascript - About form submission data

There are multiple input fields in the form for data display. Now click the button to submit some data, but some fields in the form do not need to be submitted. How to deal with it. Usually all submissions are submitted using ajax's serial number, such as $('form').serialize(). Now I only need to submit some fields and I don’t know how to write them. Please give me some advice!

PHPzPHPz2744 days ago895

reply all(6)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:22:04

    Jquery serialization is for elements with name attributes. If you want to remove some fields without submitting them, just remove the name attributes. This data will not be submitted when submitting.

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-19 10:22:04

    Use jQuery 获取部分 inputvalue

    $("input").val()

    Then send the data

    reply
    0
  • 某草草

    某草草2017-05-19 10:22:04

    Split it into two forms so that you can submit them separately

    reply
    0
  • PHP中文网

    PHP中文网2017-05-19 10:22:04

    Take out the value to be submitted and submit it as a json array

    $.post{url,{a:'a',b:'b',c:'c'},function(){}}

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:22:04

    Write a few more froms to submit as needed, or take the required values ​​and submit them, or take all the values ​​and then filter them,
    or set the input attributes that do not need to be submitted to disabled.

    reply
    0
  • 某草草

    某草草2017-05-19 10:22:04

    var formData = $.param({
                    actionID : 'publishExam',
                    classInfo : getCheckedVal("classInfoName").toString(),
                    bookletUnitInfo : getRadioVal("unitradio")
                }) + "&" + $("#examForm").serialize();

    For reference!

    reply
    0
  • Cancelreply