I am trying to make a partial view in a container div using jQuery Ajax. Here is my ajax call:
var href = { href: $(this).attr("href").substr(1) } var container = $(".customer-main-content-container"); $.ajax({ url: "@Url.Action(" CustomerMenuSelection ")", type: "POST", dataType: "html", contentType: "application/json", data: JSON.stringify(href), error: function (jqXHR, textStatus, errorThrown) { alert("ERROR: " + errorThrown.text()); }, success: function (result) { container.empty(); container.html(result).show(); } });
Update
Here is my action code:
public ActionResult CustomerMenuSelection(string href) { var user = GetCurrentUser(); var tempSensorTree = _prtgClient.GetPrtgSensorTree(user.TempPrtgGroupId.ToString()); var tempDevices = tempSensorTree.Sensortree.Nodes.Group.Device; return PartialView("_Monitor", tempDevices); }
I made the call through my action and found that it really sends all the correct data back to the view. However, my ajax-call does not work with error or callback, and I have no idea why. This happens when you click on a menu item, and the same ajax call works for all other menu items except this one. I do not see the differences between the pages. Errors do not occur, the data that I fill out is correct. My ajax call just stops.
So why don't my callbacks start?
Thanks for any help! thanks in advance Martin Johansson
jquery ajax asp.net-mvc
Martin Johansson
source share