I'm using knockoutjs with a view model method that makes a jQuery post:
class MyViewModel
{
public id = ko.observable<number>();
public name = ko.observable<string>();
...
public myMethod = function ()
{
var obj = ANYTHING
$.post('/api/controller/update', obj)
}
}
And I invoke this by binding a click attribute to the view model:
<a href="#" data-bind="click: myMethod">Do Something</a>
If I click the button, it calls the method. If the method posts with no data, it works fine. But if I pass an object of any kind, even an empty one {}
, the call fails with:
SecurityError: The operation is insecure.
var propertyValue = mapInputCallback(rootObject[indexer]);
http://localhost:35179/Scripts/knockout-3.2.0.debug.js (line 1904)
I've tried all kinds of objects here, and it seems that any object at all causes this problem, whereas using no data works fine.
So, knockout doesn't like something about this, but I can't figure out what it is, and this is completely blocking my progress. The puzzling thing to me is how I could get an error in knockout code when calling a method in jQuery that has nothing to do with the knockout code (other than that the callback method was called back from knockout).