javascript - Ajax action link opens new page instead showing alert -
i have ajax action link.
@ajax.actionlink(item.sifra_materijala, "detaljimaterijala", "normativimaterijala", new { materijal = item.sifra_materijala.tostring() }, new ajaxoptions { httpmethod = "post", onsuccess = "success", updatetargetid = "listamaterijala" }, new { id = item.sifra_materijala })
html generated link is:
<a href="/normativimaterijala/detaljimaterijala?materijal=070215" data-ajax-update="#listamaterijala" data-ajax-success="success" data-ajax-mode="replace" data-ajax-method="get" data-ajax="true" id="070215">070215</a>
this link call controller action
[httpget] public virtual jsonresult detaljimaterijala(string materijal) { var mat = (from m in db.materijalis m.sifra_materijala == materijal select m); return json(new { sifra_materijala = mat.first().ime_materijala }, jsonrequestbehavior.allowget);}
and success js function
<script type="text/javascript"> function success() { alert("result success"); }; </script>
but when click on link, instead of alert, new page opens in browser action result. have js unobtrusive jquery scripts included on page with
<script src="/scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script> <script src="/scripts/jquery-2.1.0.js"></script> <script src="/scripts/bootstrap.js"></script> <script src="/scripts/bootstrap.min.js"></script>
can me this?
Comments
Post a Comment