Hello,
I am having difficulty sending MindFusion data from client side to a MVC Controller method.
On the client side, I am getting a DiagramLink or DiagramNode when it is created by the user from the appropriate event handler. For instance, on the event for creating a link, I make an AJAX call trying to pass the new diagram link:
function onLinkCreatedByUser(sender, args)
{
var diagramLink = args.getLink();
$.ajax({
type: "POST",
url: urlHere,
data: { newDiagramLink: diagramLink },
success: function (result) {
alert("success");
},
error: function (req, status, error) {
alert(error);
}
});
}
And my controller method signature looks like this:
[HttpPost]
public ActionResult UserCreatedNewLink(DiagramLink newDiagramLink){
//do business logic
}
If I take out the parameter for the DiagramLink object, the AJAX call works. Or, if I instead pass the diagram as a JSON string, it also works.
However, I have also tried passing a ShapeNode or PointCollection, which are both MindFusion classes, but these also cause the AJAX call to fail.
Do you have a suggestion for being able to pass MindFusion data from the client side to a MVC controller method?
Trying to turn the diagram link in JSON with JSON.stringify also fails for the diagram link variable as a "circular JSON call," because that diagram link variable contains the diagram as part of the object. At least that's what the error complains about is the diagram property being JSON and it can't JSONify something that is already JSON.
Thanks in advance.