Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1017245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:40:25+00:00 2026-05-16T10:40:25+00:00

I am developing a SilverLight application wherein on browser close event, i need to

  • 0

I am developing a SilverLight application wherein on browser close event, i need to do a web service call. I have a web service method which accepts one parameter. When the user clicks on browser close event. I’ll be calling the doRelease() function. the releaseuser method requires a parameter usertoken.

I got an error when I’m calling my jQuery function CallService().

Line: 186
Error: Object expected

 var varType;
    var varUrl;
    var varData;
    var varContentType;
    var varDataType;
    var varProcessData;
    //Generic function to call AXMX/WCF  Service        
    function CallService() {
        $.ajax({
            type: varType, //GET or POST or PUT or DELETE verb
            url: varUrl, // Location of the service
            data: varData, //Data sent to server
            contentType: varContentType, // content type sent to server
            dataType: varDataType, //Expected data format from server
            processdata: varProcessData, //True or False
            success: function (msg) {//On Successfull service call
                alert("success");
                ServiceSucceeded(msg);
            },
            error: ServiceFailed// When Service call fails
        });
    }

    function Temp(usertoken) {
        varType = "POST";
        varUrl = "http://localhost/TempWS/MachineHistoryWS.asmx?op=ReleaseUser";
        varData = usertoken;
        varContentType = "application/json; charset=utf-8";
        varDataType = "json";
        varProcessData = true;

        alert("call service");

        CallService();

    }
    function ServiceSucceeded(result) {//When service call is sucessful

        alert("success");

        varType = null; varUrl = null; varData = null; varContentType = null; varDataType = null; varProcessData = null;
    }
    function ServiceFailed(result) {
        alert('Service call failed: ' + result.status + '' + result.statusText);
        varType = null; varUrl = null; varData = null; varContentType = null; varDataType = null; varProcessData = null;
    }



    function doRelease() {

        var usertoken = readCookie("usertoken");


        Temp("usertoken");
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:40:25+00:00Added an answer on May 16, 2026 at 10:40 am

    I solved my problem but not using jquery. Here’s my solution.

    function sendDataAsXML_SOAP() {
            var req_params = "", url = "", number = 0, type = "";
            /* Configure Parameters */
            url = "http://localhost/TempWS/MachineHistoryWS.asmx";
            user = "129272802615082804";
    
            req_params = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
            req_params = req_params + "<soap:Body><ReleaseUser>";
            req_params = req_params + "<credentials>" + user + "</credentials></ReleaseUser></soap:Body></soap:Envelope>";
            alert(req_params);
            /* Send XML/SOAP Request To Web Service Using Browser's Javascript DOM */
            try {
                ajax_request = new XMLHttpRequest();
            }
            catch (trymicrosoft) {
                try {
                    ajax_request = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (othermicrosoft) {
                    try {
                        ajax_request = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (failed) {
                        ajax_request = false;
                    }
                }
            }
            ajax_request.open("POST", url, true);
            ajax_request.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
            ajax_request.onreadystatechange = receiveXML_SOAPData;
            ajax_request.send(req_params);
        }
    
        function receiveXML_SOAPData() {
            if (ajax_request.readyState == 4) {
                if (ajax_request.status == 200) {
                    alert(ajax_request.responseText);
    
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Silverlight Business Application, using a RIA service, which is returning POCO
What is the correct pattern or method for developing a Silverlight application (which is
I am developing a silverlight application and I have a method that should throw
I'm developing Silverlight OOB application and I need to show web pages in it
I am developing a silverlight 4.0 application which communicates with a WCF service. The
I'm developing a Silverlight 3 Application which I want to connect to a webservice
I am developing Silverlight application with Prism 4 and WCF RIA service. I had
I am developing a Silverlight application which has a list <ListBox x:Name=_list_collection SelectionChanged=SelectionChanged ScrollViewer.VerticalScrollBarVisibility=Auto
I have a question on using MVVM within a Silverlight application I am developing.
At the moment I'm developing a web based application using Silverlight 3.0. For the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.