1

I have an eye tracker (mirametrix) running as a server in localhost. In order to capture data from this I should send a xml request as given below;

SEND:<GET ID="TIME_TICK_FREQUENCY" />

I have a web-app running as the client and I need to make a request to this server through that. I wrote the following code but it doesn't seem to send the request properly to the server.

var request = $.ajax({
            url: "http://127.0.0.1:4242",
            type: "GET",
            dataType: "xml",
            data: { 
                data:'<GET ID="TIME_TICK_FREQUENCY" />'

            },

        });

Can someone please help me with this ?

Thanks in advance

1
  • 1
    You are using jQuery. I presume you included the jQuery file? Commented Nov 9, 2012 at 10:40

2 Answers 2

1
$.ajax({
    url: ajaxurl,
    data: "<root><blah><blah></root>", 
    type: 'POST',
    contentType: "text/xml",
    dataType: "text",
    success : parse,
    error : function (xhr, ajaxOptions, thrownError){  
        console.log(xhr.status);          
        console.log(thrownError);
    } 
}); 

I think you need to post it.

Sign up to request clarification or add additional context in comments.

Comments

1

this is not plain javascript.. looks more like jquery.. also what do you mean with 'properly'. It's kind sending it, but not really? Aside from that, I see the following problems

  • The url is wrong, and although your browser may handle it, your url should end with a slash.
  • Your xml is invalid. Needs to start with <?xml version="1.0"?>.
  • If you accessed this script through a different host than 127.0.0.1., or if the script is running on a different port than 4242, this will not work without CORS headers on the server.

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.