Python and JQuery/AJAX

Python and JQuery/AJAX

Postby phalse » Mon Jul 01, 2013 5:58 pm

Hello All,
I am trying to pass a minidom xml document from python to a webpage using AJAX with the following code:
Code: Select all
$(document).ready(function() {
         parameters = JSON.stringify({request:'queryAll'});

         $.ajax({
      url: 'cgi-bin/command.py',
      type: 'POST',
      data: parameters,
      dataType: 'xml',
      error: function(jqXHR){
          alert("ERROR:" + jqXHR.responseXML);
      },
      success: alert("success")
         });

Command.py creates an xml document, populates a few fields and saves the doc as 'result'. The final few lines of command.py are:
Code: Select all
print "Content-Type: text/xml"
print
print result


Is this the proper way to do this? I get the error and the responseXML is blank so I am assuming Ajax is looking for a different format for XML?
Thanks for the help
phalse
 
Posts: 4
Joined: Mon Jul 01, 2013 1:55 pm

Return to Web Development

Who is online

Users browsing this forum: No registered users and 3 guests