views:

52

answers:

1

i am trying to pass in a selector into the ID variable but this doesn't seem to work as it blows up at runtime.

what is wrong with the below syntax ?

<script type="text/javascript">
    $(document).ready(function() {

    $(".dblclick").editable('<%=Url.Action("UpdateSettings","Photos", new { id = $(this).attr("id") }) %>', {
            tooltip: "Doubleclick to edit...",
            event: "dblclick",
            style: 'display: inline; width:400px;'
        });

    });

+2  A: 

Have you tried

<script type="text/javascript">
    $(document).ready(function() {
    var updateSettingsAction = '<%=Url.Action("UpdateSettings","Photos") %>';
    $(".dblclick").editable(updateSettingsAction + '/?id=' + $(this).attr("id"), {
            tooltip: "Doubleclick to edit...",
            event: "dblclick",
            style: 'display: inline; width:400px;'
        });

    });
Daniel A. White