No matter what I do, I can't call this js function successfully without generating error.
<script type="text/javascript">
function getmessage() {
//$('#discussion').append('<li>dummy</li>');
}
$(function () {
var chat = $.coection.chatHub;
chat.client.broadcastMessage = function (message) {
var encodedMsg = $('<div />').text(message).html();
$('#discussion').append('<li>' + encodedMsg + '</li>');
};
$.coection.hub.start().done(function () {
$('#sendmessage').click(function () {
chat.server.send($('#message').val());
});
});
});
</script>
error: WKErrorDomain code; 4
I have made sure that I inherit WKNavigaitonDelegate, set view as it's delegate and calling it from didFinishNavigation
Note that I can execute new js blocks just fine from my swift code with no issues, but when calling that existing function, it doesn't work.

