Solved

Submitting data from Pocket internet explorer.

Posted on 2004-08-31
4
566 Views
Last Modified: 2012-08-13
On a Pocket Internet Explorer I have a html page that runs a JavaScript function that uses an ActiveX object to continously log GPS data.

Now, what I would like to do, is to store these GPS data in a MySQL database on my Server.

My only problem is, that I cannot figure out a way to send my data to the server without submitting the page, which I do not wish to do as this would require me to establish a new link to my GPS receiver - which takes to long.

A few facts:

1)   In PIE JavaScript setInterval is not supported.

2)   I cannot use the <meta refresh> method, as this would take to long (due to the time it takes to refresh the page and the time it takes for the script to connect to the GPS)

3)   If I simply use a do...while loop, I cannot submit the form fom within this loop.

4)   In PIE frames are not supported.

If anyone can give me a hint, I would be very happy indeed......
0
Comment
Question by:Finduilas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Accepted Solution

by:
PeterCN earned 500 total points
ID: 11941556
I dunno if it works in PIE javascript, but you never know :) There is an xmlhttp activeX object that allows you to do just that. Take a look at the code below:


<html>
<head>
      <script type="text/javascript">

      window.onload = function() {
            var file = "senddata.asp?data=test";
            
            try {
                  // moz/ff
                  xmlhttp = new XMLHttpRequest();
            } catch (e) {
                  // winIE
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            
            xmlhttp.open("POST", file, false);
            xmlhttp.send(null);      
            
            var responseXML = xmlhttp.responseXML;   // the returned xml object
            var responseTxt = xmlhttp.responseText;    // the source

            document.body.appendChild(
                  document.createTextNode(responseTxt)
            );
      }

      </script>
</head>
<body style="white-space:pre;">

</body>
</html>


With the xmlhttp.open() and send() methods you can send an underwater post/request to the server (the file variable contains the url in this case). the "false" value for the 3rd async attribute in the open() makes the code wait until the request has been answered, so there's no need for timeouts or intervals etc.
In this demo the returned xml is displayed on screen, but in case of only sending stuff you could just as well ignore the returning answers. The senddata.asp that I tested this with looks like this:


<?xml version="1.0" encoding="UTF-8" ?>
<response>
      <%= request("data") %>
</response>
0
 
LVL 15

Expert Comment

by:justinbillig
ID: 11943489
Does it support java applets .. cause if it does you can use remote scripting
0
 
LVL 1

Author Comment

by:Finduilas
ID: 11949680
To PeterCN.

It works like a charm.

All I had to do was to use the following four lines (note that the ActiveX object is different on Pocket PC).

xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var file = url;
xmlhttp.open("POST", file, false);
xmlhttp.send(null);

I'm one happy Dane right now!!!!!
0
 
LVL 1

Expert Comment

by:Quintin79
ID: 12040716
may i ask how does your GPS give you the location data ?  does it save a file off to the memory of the device ? how do you get the gps data into your client side web page to do the submit ?

thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question