LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ajax and labview how to

hi im trying to use ajax to send and receive variables i saw this (http://forums.ni.com/ni/board/message?board.id=170&message.id=375263&requireLogin=False) example, and im trying to use similar code to send data to a shared variable that i created using LV8.6 but for same reason the data never reach the vi,i cant explain why if sameone can help i would apreciate, here is the code:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <script language="JavaScript" type="text/javascript">
            function getXMLHttpRequest()    {
                var request = false;
                try    {
                    request = new XMLHttpRequest();
                }
                catch(err1)    {
                    try    {
                        request = new ActiveXObject("Msxm12.XMLHTTP");
                    }
                    catch(err2)    {
                        try    {
                            request = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch(err3)    {
                            request = false;
                        }
                    }
                }
                return request;
            }
            var request = new XMLHttpRequest();
            function upload(name,value){
                var upUrl = "http://localhost/filtrowebservice/" + name + "/" + value;
                request.open("GET", upUrl, true);
                request.send(null);
            }
            function responseAjax(){
                alert(request.readyState);
                alert(request.status);
                alert(request.responseText);
                var data = request.responseText;
                document.getElementById("textout").innerHTML = data;
            }
        </script>
    </head>
    <body>
        <form>
            <input type="text" name="vin" value="" />
            <input type="submit" value="submit" onclick="upload(name,value)"/>
        </form>
        <?php
        ?>
    </body>
</html>

 

 

0 Kudos
Message 1 of 5
(3,823 Views)
Why go through an ajax script?  Would it not be easier and more efficient to do requests directly to the page that the ajax script does the request to?
0 Kudos
Message 2 of 5
(3,806 Views)
yes it is easier and works well but i need a good looking and more user friendlly interface, so i believe ajax can give me that. Its more a matter of visual than efficiency
0 Kudos
Message 3 of 5
(3,784 Views)

Are you able to post the VI as well?  You've only given us half of the info we need...

 

If the ajax part isnt working, you may want to try a web development forum. 😉

0 Kudos
Message 4 of 5
(3,766 Views)
yes maybe you're right the labview part is working fine, i can get variables and i can send variables no problem with that, my problem is using a third part technology to do what i can directlly to the url's, i'll try to make this work tanks
0 Kudos
Message 5 of 5
(3,756 Views)