t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

/n is not working on text for sweetalert when html is set to true with Json #858

Closed ttaylor29 closed 6 years ago

ttaylor29 commented 6 years ago

Shouldn't this work?

return Json(new { success = false, errorMessage = string.Format("MyMessage \n\n\n Testing") });

                        var errorMsg = data.errorMessage;

                        swal({
                            title: 'Failed to delete organization.',
                            text: errorMsg,
                            type: 'error',
                            html: true,

                            showCancelButton: false
                        });
ttaylor29 commented 6 years ago

I needed to set the actual html comment:

                        swal({
                            title: 'Failed to delete organization.',
                            html: data.errorMessage,
                            type: 'error',                           
                            showCancelButton: false
                        });