#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Getting VBscript to work with ajax?


    Hi,

    I'm having problems passing a vbscript variable through ajax. Is that even possible? Is there a workaround for something like below? My idea is to grab the computer name via vbs and send it as a form to another webpage to process it. This is being housed in a jsp page.

    The main issue is that while the computer name is saved to the variable msg, I don't know how to get that variable working in the second part:

    objHTTP.send "field1=msg"

    It of course, just sends msg rather than the computer name.

    Any ideas?

    <script type="text/vbscript">
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
    For Each objOperatingSystem in colOperatingSystems
    msg = objOperatingSystem.Caption
    document.write(msg)
    Next
    Set objHTTP = CreateObject("Microsoft.XMLHTTP")


    objHTTP.open "POST", "http://localhost:8080/IQCS/SelfService/test/rectest.jsp", False
    objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    objHTTP.send "field1=msg"

    Set objHTTP = Nothing



    </script>
  2. #2
  3. Type Cast Exception
    Devshed Supreme Being (6500+ posts)

    Join Date
    Apr 2004
    Location
    OAKLAND CA | Adam's Point (Fairyland)
    Posts
    14,954
    Rep Power
    8617
    objHTTP.send "field1=msg"

    ->

    objHTTP.send "field1=" & msg

    Comments on this post

    • spas2k agrees
    medialint.com

    “Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by medialint
    objHTTP.send "field1=msg"

    ->

    objHTTP.send "field1=" & msg
    Thanks man, works great!

IMN logo majestic logo threadwatch logo seochat tools logo