在Sinatra中将信息从JavaScript传递给RB

时间:2012-11-17 15:05:22

标签: jquery ruby sinatra

我正在从元素中读取一些数据,并希望将收到的信息发送到我的.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文件中使用它

0 个答案:

没有答案