0

i got a ui-dialog which i need to set its content message but i can't seem to see the text my function is as follows

function showSuccessMessage(user,reg)
{
    var msg;
    if (reg == true)
         msg = "User "+user.toString() +" Successfully Registered";
    else
         msg = "User " + user.toString() + " Successfully Edited";
    $("#box").dialog({
          title:"User Registration",         
          html:msg,
          modal: true,
          buttons: {
                 Ok: function () {
                      $(this).dialog("close");
                        var s = "../Pages/main.aspx";                
                        window.location = s;
                     }
           }
     });

} // end function

any idea what i'm setting wrong all the other properties accept html work is html even the content text attribute ? i couldn't come across any source verifying this

thanks in advance.

3
  • 1
    i don't know what an XSS hole is maybe your calling me an XSS hole :) Commented Oct 16, 2011 at 1:27
  • en.wikipedia.org/wiki/Cross-site_scripting By putting user-controlled data in the HTML, you allow users to inject HTML or Javascript. Commented Oct 16, 2011 at 1:29
  • o'k ill check it out thanks again. Commented Oct 16, 2011 at 1:59

2 Answers 2

1

$.dialog doesn't have an html parameter.

You should set the text of the element directly:

$('#box').text(msg)
Sign up to request clarification or add additional context in comments.

Comments

1

This will work:

function showSuccessMessage(user,reg)
{
    var msg;
    if (reg == true)
         $('#box').html("User "+user.toString() +" Successfully Registered");
    else
         $('#box').html("User " + user.toString() + " Successfully Edited");
    $("#box").dialog({
          title:"User Registration",         

          modal: true,
          buttons: {
                 Ok: function () {
                      $(this).dialog("close");
                        var s = "../Pages/main.aspx";                
                        window.location = s;
                     }
           }
     });
}

1 Comment

i just found an answer like a minute ago which says the same :) stackoverflow.com/questions/3336915/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.