Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I trying to show message box using jquery

JavaScript
<script type="text/javascript">
     function ShowDialog(message) {
         $(function () {
             $("#dialog").html(message);
             $("#dialog").dialog({
                 title: "Message",
                 buttons: {
                     Close: function () {
                         $(this).dialog('close');
                     }
                 },
                 modal: true
             });
         });
     };
</script>
<div id="dialog" style="display: none">
    </div>

I am calling js method from cs page,
C#
ScriptManager.RegisterClientScriptBlock(this, GetType(), "Authentication Type", "JavaScript:ShowDialog('Testing');", true);

I am getting the below error
Microsoft JScript runtime error: '$' is undefined

Please help. Thanks in advance
Posted

1 solution

Quote:
Microsoft JScript runtime error: '$' is undefined
That means the jQuery file in not included in the aspx page. Please include that inside head section of the Page.

You can include the online file also like below. Else just provide correct path in src attribute.
HTML
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
 
Share this answer
 
Comments
srmohanr 3-Mar-14 1:37am    
Thanks, it's working now
Most welcome. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900