0

I have a javascript file (viewer.js) situated in Scripts/viewer.js My default.aspx has a javascript functions that calls a c# function in the default.aspx.cs ( it sends a http webrequest)

Now I want to call from the viewer.js the function in default.aspx which calls the c# function.

How can I handle this in my viewer.js?

I need to do this because I work with 3D objects and the select event is on the viewer.js

When I select the 3D object it needs to call the function in default.aspx...

Scripts/viewer.js

function ClickPickItem(item) {

        $("#properties").show();
        /*Call function App() */
    }

Default.aspx

function App() {
     PageMethods.Connect(callback);
 }

Default.aspx.cs

     [WebMethod]
        public static string Connect()
        {
            string rsp = DigestAuthFixer.GrabResponse("http://<username>:<password>@nextbus.mxdata.co.uk/nextbuses/1.0/1");
... CODE TO MAKE HTTPWEBREQUEST

}

Sorry if I'm not clear enough

I don't see another option like this

What I need to do?

Thanks!

1 Answer 1

1

Assuming viewer.js is included in the Default.aspx's html, after the declaration of App:

<script type="text/javascript" src="Scripts/viewer.js"></script>

You should simply be able to invoke the function, assuming it was created within global scope (or the scope of the document).

function ClickPickItem(item) {

    $("#properties").show();
    App();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.