Search code examples
jqueryasp.net-mvcasp.net-ajaxjqmodal

jqModal passing parameters


how do you pass data to the jqModal? For example, when Button2 is clicked can i pass the button's id or a hidden field and have the controller pick it up?

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript">

    $(document).ready(function() {
        $('#title').css('background-color', 'red');
        $('#dialog').jqm({ trigger: '.Button2', ajax: "/Home/AddAssignment" });
    });

</script>

    <h2 id="title">Index</h2>
    <div id="dialog" class="jqmWindow">This is a dialog window</div>
        <a class="Button2" id="Button2">Test</a>
    <div id="someDiv">some div</div>

</asp:Content>

Thanks, rodchar


Solution

  • $.post("/Articles/jQueryAddComment", { commentText: commentText, id: id, type: commentType },function.....
    

    I call my controller like this and I pass in the parameters as you see above.

    You could use this.id if you want to pass the id to the controller.

    Is this what you were after or am I off base?