I have AJAX request that looks like this:
jsonData = JSON.stringify({stuff: stuff});
$.ajax({
url: '<%=Url.Action("myMethod", "myController") %>',
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: jsonData,
success: function (data) {
$("#myDiv").append('<span><%=Html.ActionLink("Details", "myMethod", new {id = data.id })%></span>');
}
)};
EDIT! I am trying to append this Actionlink to a div on "success". I somehow forgot the $("#myDiv").append() code during my initial post.
In the new {id = data.id } section, I'd like to use the data.id (a javascript variable) in this actionlink.
I keep getting errors saying either data is not defined, or too many characters in literal, etc..
Has anyone successfully done this before?