i have below code /function ,it gives error ,
if i check same issue in chrome it says
Uncaught TypeError: Cannot read property 'sendPrivateMessage' of undefined
at HTMLInputElement. (LetsChat:180)
at HTMLInputElement.dispatch (jquery-1.10.2.min.js:22)
at HTMLInputElement.v.handle (jquery-1.10.2.min.js:22)
in forefox it says below (same issue)
TypeError: chat.server is undefinedLetsChat:180:21
- function createPrivateChatWindow(userId, ctrId, userName,chat) {
- alert("createPrivateChatWindow method")
- var div = '+ ctrId + '" class="ui-widget-content draggable" rel="0">' +';
- '
' +' +- '
' +' +- '
' +
- '
- '' + userName + '' +
- '' +
- '
- '
' +' +- '
- '
' +' +- '' +
- '' +
- '
- '' +
- '
- '
- var $div = $(div);
- // Send Button event
- $div.find("#btnSendMessage").click(function () {
- alert(chat)
- // console.log(chat.connectionid)
- alert("send click")
- $textBox = $div.find("#txtPrivateMessage");
- var msg = $textBox.val();
- alert("msg is " + msg)
- if (msg.length > 0) {
- chat.server.sendPrivateMessage(userId, $("#connlbl").text(), msg, 'Click');
- $textBox.val('');
- }
- });
- // Text Box event
- $div.find("#txtPrivateMessage").keyup(function (e) {
- if (e.which == 13) {
- $div.find("#btnSendMessage").click();
- }
- // Typing
- $textBox = $div.find("#txtPrivateMessage");
- var msg = $textBox.val();
- if (msg.length > 0) {
- // chat.server.sendPrivateMessage(userId, msg, 'Type');
- }
- else {
- // chat.server.sendPrivateMessage(userId, msg, 'Empty');
- }
- // clearInterval(refreshId);
- // checkTyping(chat, userId, msg, $div, 5000);
- });
- AddDivToContainer($div);
- }
- public void SendPrivateMessage(string toUserId,string fromuserid ,string message, string status)
- {
- }
Jeeva SubburajPosted Jun 4, 2019, 8:07 AM