c# - ActionResult not returning dynamic HTML -
i having problems actionresult method. in system, have simple public method returns html div message, this:
public static string divmsg(string message) { string divmsg = string.empty; divmsg = "<div id='error-message'>"; divmsg = string.format("{0}<p>{1}</p>", divmsg, message); divmsg += "</div>"; return divmsg; } the string return placed inside viewbag, this:
viewbag.divmsg = base.utilities.divmsg("some message here."); the viewbag located _default.cshtml file, near @renderbody() command, , works fine in actionresult method have view associated it.
but when have no view actionresult method, this:
public actionresult integrity(int? id) { product obj = repositoryproduct.find(id); if (obj != null) { viewbag.divmsg = base.utilities.divmsg("product found."); return redirecttoaction("index", "products"); } else { viewbag.divmsg = base.utilities.divmsg("product not found."); return redirecttoaction("index", "products"); } } the html message not displayed on page. don't have view named "integrity" in project, , reason im using structure because call method jquery index , have little loading animation on button fires method needs interrupted after message returns, this:
$(document).ready(function () { $('.btnintegration').on('click', function () { var $btn = $(this).button('loading'); var idproduct = $(this).data('id'); $.ajax({ url: '/products/integrity/' + idproduct, success: function (data) { $btn.button('reset'); }, error: function (data) { $btn.button('reset'); } }); }) }); anybody can me this? ps: sorry bad english, it's not 1st language.
Comments
Post a Comment