I am using [Google's JQuery MsgBox library](http://code.google.com/p/jquery-msgbox/) to display messages on screen. Below is my code to execute JQuery from code-behind:

```
  public static void GetScript(System.Web.HttpResponse r, string customErrorMessage)
    {
        r.Write("<script type='text/javascript' language='javascript'>function($){new $.msgbox('Hello world').show()};</script>");
    }

```

Where I am going wrong? The parameters are passed correctly, but the Script code is not executing. If I simply put: Alert('....'), it works, but JQuery is not working.

My ASP.NET 2.0 application uses Master Page and the above code resides in a Content Form. I checked the LINK tags in the Master Page. The paths are correct and all needed files are referenced correctly.

**Edited**

Updated code as below:

```
public static void GetScript(System.Web.HttpResponse r, string customErrorMessage)
{
    string[] dependencyFiles = { "/Resources/JQueryScripts/Core/jquery.min.js",
                                 "/Resources/JQueryScripts/MsgBox/jquery.msgbox.js",
                                 "/Resources/JQueryScripts/MsgBox/jquery.dragndrop.min.js",
                                 "/Resources/JQueryScripts/MsgBox/jquery.msgbox.css" };

    r.AddFileDependencies(dependencyFiles);
    r.Write("<script type='text/javascript' language='javascript'>function($){new $.msgbox('Hello world').show()}</script>");
}

```

**Edited**
It is showing error: `Sys is undefined`, when debug is enabled in IE. Below is the screenshot:

![enter image description here](https://i.stack.imgur.com/lORB2.png)