开发者

How to pass on variables to a modal dialog using jquery?

I'm creating a calendar dynamically in rails and I want to open a modal dialog showing the day the user clicked (So I can use a form in there to m开发者_开发问答ake a reservation on that specific day). How can I do that? Here's my code: BTW, I'm using SIMPLE MODAL (http://www.ericmmartin.com/projects/simplemodal-demos/)

View: (I shorted it)

<table>
 <tr>
  <td>Monday</td>
  <td>Tuesday</td>
  ...
 </tr>
 <tr>
    <% for i in (0..6)    #Weekdays %>
           <td><a href='#' class='basic'><%= @date.day %></a></td></table>
    <% end %>
 <tr/>
</table>

<div id="basic-modal-content">
     <!-- Here's the hidden form that will make the reservation. 
          This is the modal dialog content!. Here is where I need to show the day clicked-->
</div>

The Javascript code: (I just open it)

$('.basic').click(function (e) {
    $('#basic-modal-content').modal();
    return false;
});

Thanks a lot! I hope any of you could help me.

Gus


.modal() returns a jQuery object, you could set the html in it like this .modal().html("Content");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜