cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
217
Views
0
Helpful
0
Comments
cdnadmin
Community Member

Subject: putxml using jQuery $.ajax() 405 error
Replied by: Phil Gorman on 08-02-2012 11:07:52 AM
Hi

I've used the used jQuery script below to post a XML string to the putxml method but I get the following error returned:

OPTIONS http://<ip>/putxml 405 (Method Not Allowed)
XMLHttpRequest cannot load http://<IP>/putxml. Origin http://livamx01 is not allowed by Access-Control-Allow-Origin.

Any Ideas?

$('#Move').bind('click', function(){
                        var str = '<Command><Camera><PositionSet command="True"><CameraId>1</CameraId><Pan>200</Pan><Tilt>200</Tilt></PositionSet></Camera></Command>';
                        $.ajax({
                                type: "POST",
                                contentType: "text/xml",
                                processData: false,
                                url: "http://ip/putxml",
                                datatype: "text/xml",
                                data: str,
                                success: function(msg) { 
                                    alert('hello!');
                                },
                                error: function(requets, error) {
                                    alert('error:' + error);
                                }
                        });  
                    });

Thanks,

God Bless,

Phil.
This document was generated from CDN thread

Created by: David Bruun-Lie on 08-02-2012 01:55:43 PM
Hi Phil,
Change the url part to url: "http://ip/formputxml",

🙂

ps: you also need to authenticate this request with basic authentication

Cheers,
David
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links