Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Simple CGI request and Python reply

Reply
Thread Tools

Simple CGI request and Python reply

 
 
Greg Corradini
Guest
Posts: n/a
 
      04-08-2009

Hello,
I'm trying to implement something very simple without using a Python
WebFramework and I need some advice. I want to send a comma delimited string
from the client to a server-side Python script. My initial plan was to use a
JavaScript function (see below) called "makerequest" that creates a
XMLHttpRequest object and GETs the output from a Python script. I've used
this function before to field requests (in those cases the parameter "data"
passed in the XMLHttpRequest.send() method is null). So I thought I could
just pass some data in and be able to retrieve it with Python. I'm not sure
how to do this. I've used forms with cgi/Python before. However, I don't
want to use a form here. I want Python to handle the "data" variable being
passed without looking for field names using .FieldStorage(). Can that be
done?

Maybe making a request is not the quickest route to do what I want. Ideas?

function makerequest(serverPage,objID,data)
{
var obj = document.getElementById(objID);
xmlhttp.open("GET",serverPage);
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(data);
}


--
View this message in context: http://www.nabble.com/Simple-CGI-req...p22952274.html
Sent from the Python - python-list mailing list archive at Nabble.com.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reply to posts on google groups (and not reply to just author) davidj411 Python 1 05-27-2008 04:13 PM
Reply....Reply All not in Browser Denny B Computer Support 3 04-24-2006 01:59 PM
DO NOT REPLY TO---> RICHARD SCHURCH (ricrat) <--- DO NOT REPLY Non scrivetemi DVD Video 0 04-16-2006 05:58 AM
can sombody tell me how to reply to sombody elses message and include the original message in the reply? Computer Support 3 08-24-2003 12:58 PM
Re: can sombody tell me how to reply to sombody elses message and include the original message in the reply? Computer Support 0 07-24-2003 09:21 PM



Advertisments