<input name="id" type="text"/>
<select class="form-control" id="placeSelect" name="place">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
原来的做法:
alert($('select>option:selected').serialize())//''
alert(typeof 'select>option:selected').serialize();//string
之后尝试了这种,就好了:
alert($('select').serialize());//place=1
alert(typeof $('select').serialize());//string
同理:
alert($('input,select>option:selected').serializeArray());//[object Object]
alert(JSON.stringify($('input,select>option:selected').serializeArray()));//[{"name":"id","value":""}]
alert($('input,select').serializeArray());//[object Object],[object Object]
alert(JSON.stringify($('input,select').serializeArray()));//[{"name":"id","value":""},{"name":"place","value":"1"}]