jQuery.ajax calls webmethod(c#) with Speechsynthesizer

Asked

Viewed 77 times

0

I have a javascript method that checks if there is an unread message. If there displays the image of an envelope.

The method executes a jQuery.ajax calling a Webmethod that returns the amount of unread messages.

But now I need to add Speechsynthesizer(C#) on Webmethod to speak the unread messages. But when I add this feature Success, complete or jQuery.ajax error does not run, and I don’t know how to fix it.

1 answer

0

I managed to resolve it this way: $. ajax({url: "your Webmethod", Success: Function(result){ if('speechSynthesis' in window){ var Speech = new Speechsynthesisutterance(result); Speech.lang = 'en-BR'; window.speechSynthesis.Speak(Speech); } }});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.