0

My Jquery function goes like this

<script language="javascript" src="jquery.js">
    function TestJQ() {
        alert("Inside a JQ Function");
    }
</script>

I also added jquery.js file to project.

When i try to call this function from Silverlight project it throws an error Failed to Invoke

My Silver light code:

void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            HtmlPage.RegisterScriptableObject("silverlightApplication", this);

        }

private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            HtmlPage.Window.Invoke("TestJQ");
        }

Important: When i remove the src value from script attribute, it works.

Can any one help on this?

Edited by mike_2000_17: Fixed formatting

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by mhs.praveen
1

Try this
<script type="text/javascript" src="jquery.js"></script>
<script language="javascript">
function TestJQ() {
alert("Inside a JQ Function");
}
</script>

First line will add javascript script to your project, and the second is additional javascript code that isn't connected with 'jquery.js' code.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.