2017-12-19 5 views
1

toastrを使用してユーザーに通知します。私はそれを設定するためにthisのガイドに続いています。しかし、エラーメッセージ「Uncaught TypeError: toastr is not a function」が表示されます。私はネットワークタブを見て、ファイルが適切に読み込まれています。確かにcdnで試してみた。しかし、運がない。これが私の使い方です:toastrを使用しようとすると「toastrは関数エラーではありません」

toastr('Are you the 6 fingered man?'); 

デモと同じです。私が間違っていることについての示唆はありますか?

+0

**この行の前にtoastrスクリプト**を含めていますか? – sabithpocker

+0

はい。それを解決しました。このような 'toastr'を宣言しなければならなかったのは、コマンド:toastr ["成功 "]("テストメッセージ "、"テスト ")'です。 – AllramEst

+0

あなた自身の質問への回答を投稿し、問題の内容とそれを解決するために必要なことを詳しく説明するか、自分の投稿を削除することができます。 – connexo

答えて

3

がリンクされたドキュメントによると、それはこのように使用する必要があります:あなたは、機能情報に電話をするのを忘れた

toastr.info('Are you the 6 fingered man?') 

()。

+0

私は知っていますが、それは仕事をしませんでした。 – AllramEst

+0

あなたのコードを試して、それがうまくいった、ありがとう。あなたの時間を無駄にして申し訳ありません。 – AllramEst

0

以下のようにtoastr関数を使用する必要があります。

// Display a warning toast, with no title 
toastr.warning('My name is Inigo Montoya. You killed my father, prepare to die!') 

// Display a success toast, with a title 
toastr.success('Have fun storming the castle!', 'Miracle Max Says') 

// Display an error toast, with a title 
toastr.error('I do not think that word means what you think it means.', 'Inconceivable!') 

// Immediately remove current toasts without using animation 
toastr.remove() 

// Remove current toasts using animation 
toastr.clear() 

// Override global options 
toastr.success('We do have the Kapua suite available.', 'Turtle Bay Resort', {timeOut: 5000}) 
+0

はそれがわかっています。 – AllramEst

0

documentationは、情報、警告、成功、エラーまたはオプションでtoastr使用してくださいを参照してください。

toastr.info('Are you the 6 fingered man?'); 
関連する問題