Reputation: 1209
I don't know what is wrong, I have this JavaScript function:
<script charset="utf-8" type="text/javascript">
$(document).ready(function(){
//initialize the javascript
App.init();
@if(Session::has('message'))
var msg = '{{ Session::get('message') }}';
console.log(msg);
swal({
title: "",
text: 'compañia',
type: "warning",
confirmButtonText: "Ok!",
closeOnConfirm: false
});
$(window).bind("load", function() {
$.gritter.add({
title: 'Atencion',
text: 'compañia',
image: '{{ asset('images/clipboard_icon.png') }}',
class_name: 'danger',
time: ''
});
return false;
});
@endif
});
</script>
The problem is that sweet alerts doesn't display: 'compañia'
it displays 'compañia'
but the gritter message is correctly displaying the word. (See picture)
As you can see the red gritter correctly displays the word, but the sweet alert doesn't,
The file is UTF-8 encoded, so is the meta and the script also just in case, and before you ask why I put 'compañia'
its part of a larger message that is send by Laravel on the session and retrieved by the view in that format.
Anyway my real question is why does the gritted display the word fine and how can I fix it so it works also on sweet alert.
Upvotes: 2
Views: 7872
Reputation: 1505
I fixed it by setting html to the text.
swal({
title: "",
text: 'compañia',
type: "warning",
confirmButtonText: "Ok!",
closeOnConfirm: false,
html: 'compañia'
});
Upvotes: 1
Reputation: 1209
I just fixed it by adding html: true
to the function:
swal({
title: "",
text: 'compañia',
type: "warning",
confirmButtonText: "Ok!",
closeOnConfirm: false,
html: true
});
Upvotes: 8