jQuery.ajax calls webmethod (c #) with SpeechSynthesizer

0

I have a javascript method that checks for an unread message. If it exists it displays the image of an envelope.

The method executes a jQuery.ajax that calls a WebMethod that returns the amount of unread messages.

But now I need to add SpeechSynthesizer (C #) in WebMethod to speak the unread messages. However when I add this functionality the success, complete or jQuery.ajax error is not executed, and I do not know how to solve it.

    
asked by anonymous 30.03.2017 / 16:42

1 answer

0

I was able to solve this: $ .ajax ({url: "your WebMethod", success: function (result) {    if ('speechSynthesis' in window) {       var speech = new SpeechSynthesisUtterance (result);       speech.lang = 'en-GB';       window.speechSynthesis.speak (speech);     } }});

    
10.04.2017 / 15:11