我如何通过序列化获得复选框的价值?

时间:2016-08-23 03:14:43

标签: php ajax

如何通过序列化获取复选框值?

      <configSections>
     <section name="enterpriseLibrary.ConfigurationSource.SomeThingElse" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  </configSections>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="4.1.0.0" newVersion="5.0.505.0" />
        <publisherPolicy apply="no" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="4.1.0.0" newVersion="5.0.505.0" />
        <publisherPolicy apply="no" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  <enterpriseLibrary.ConfigurationSource selectedSource="Local Application Configuration Source">
    <sources>
      <add name="Local Application Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" filePath="C:\inetpub\SomeThingElse\WebEntLib.config" />
    </sources>
    <redirectSections>
      <add sourceName="Local Application Configuration Source" name="loggingConfiguration" />
    </redirectSections>
  </enterpriseLibrary.ConfigurationSource>

我完全有2个复选框

我可以得到以下值:开(如果选中这些复选框)来自account_ing方

但我的复选框的值是:1

我怎样才能获得复选框值?

1 个答案:

答案 0 :(得分:1)

在输入复选框html中提供所需的值,例如:

<input type="checkbox" name="chk" value="1" />

在Jquery中:

$("input[type='checkbox']").val();    // will give you the assigned value ie 1

如果你使用的是serialize(),那么如果选中它,它将给出1。