Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Mvc-3 Function with parameter
    primarykey
    data
    text
    <p>I have this page</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("#delete").click(function () { if (confirm) { $("#divSchedules").load('@Url.Content("~/Export/ScheduleDelete/")'); } else { return false; } }); }); &lt;/script&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Description&lt;/td&gt; &lt;td&gt;Schedule&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; @foreach (var item in Model) { &lt;tr&gt; &lt;td&gt;@item.Description&lt;/td&gt; &lt;td&gt;@item.Schedule&lt;/td&gt; &lt;td&gt;&lt;a href="@Url.Action("ScheduleEdit", new { @id = item.Id })" class="popLink"&gt;&lt;img alt="" src="@Url.Content("~/Content/images/icons/edit.gif")" style="border:none;" /&gt;&lt;/a&gt; &lt;img alt="" src="@Url.Content("~/Content/images/icons/delete.gif")" style="border:none;" id="delete" /&gt;&lt;/td&gt; &lt;/tr&gt; } &lt;/table&gt; </code></pre> <p>The Jquery function there is being triggered by elements with id="delete", for instance, a img tag.</p> <p>Can someone help me please, I need to have this Jquery function to have a parameter passed using onclick like for example</p> <pre><code>$(document).ready(function () { $("#delete").click(function (id) { if (confirm) { $("#divSchedules").load('@Url.Content("~/Export/ScheduleDelete/" + id)'); } else { return false; } }); }); &lt;img alt="" src="@Url.Content("~/Content/images/icons/delete.gif")" style="border:none;" onclick="delete(@item.Id)" /&gt; </code></pre> <p>I have added id on jquery as parameter. I tried that but always having compile error "id not in context" thing.</p> <p>Could someone please help? Thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload