我正在从元素中读取一些数据,并希望将收到的信息发送到我的 .rb 文件,我需要将其作为 JSON 发送吗?
<li id="stream1">
<label>Width: </label><input type="text" name="stream_width" size="5" class="width"><span>px</span>
<label>Height: </label><input type="text" name="stream_height" size="5" class="height"><span>px</span>
<label>Bitrate: </label><input type="text" name="stream_bitrate" size="5" class="bitrate"><span>kbps</span>
</br>
</li>
<li id="stream2">
<label>Width: </label><input type="text" name="stream_width" size="5" class="width"><span>px</span>
<label>Height: </label><input type="text" name="stream_height" size="5" class="height"><span>px</span>
<label>Bitrate: </label><input type="text" name="stream_bitrate" size="5" class="bitrate"><span>kbps</span>
</br>
</li>
$('#checkInfo').click(function(){
widths = $('.width');
heights = $('.height');
bitrates = $('.bitrate');
$.each(widths, function(){
console.log($(this).val());
});
$.each(heights, function(){
console.log($(this).val());
});
$.each(bitrates, function(){
console.log($(this).val());
});
在这里,我想存储 console.log 中显示的信息,并在我的 .rb 文件中使用它