Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using GET() parameters in a python script

Using GET() parameters in a python script

Using GET() parameters in a python script

Hi All,

I am trying to send some values to a python script using an AJAX call. The AJAX is calling the script properly because if I plug the values directly into the script it executes properly.

The problem I am having is when I try to send the values to my script by embedding them in the URL. Here is the JavaScript where I am sending the parameters:

CODE --> JavaScript

function sndCmd(devID, cmd){
//	alert(devID);
//	alert(cmd);
  var command = new XMLHttpRequest();
   command.onreadystatechange = function() {
    if (command.readyState == 4 && command.status == 200) {
     var result = command.responseText;
  command.open("GET", "http://localhost/cgi-bin/kipro/transport.py?devID="+devID+"&cmd="+cmd, true);

and here is the function I am trying to parse the url with:

CODE --> python

#!C:\Python27\python.exe -u
import cgi
import kipro

data = cgi.fieldStorage()

devID = data.getvalue('devID')
cmd = data.getvalue('cmd')

client = kipro.Client(devID)

I have researched and the best I could find was the python get() method but every example was using a URL that was included and parsed in the same python script. I don't know how I would use the get() method with a URL that was being sent to the script.

Any help is appreciated.

Thanks in advance,


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close