Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9028891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:06:55+00:00 2026-06-16T07:06:55+00:00

I have a website which contains some JavaScript code. On a different server, I

  • 0

I have a website which contains some JavaScript code. On a different server, I have a python script. I am trying to send data to the python script and then have the python script return some text.

The JavaScript calls the python file with a call like:

//server.example.com/cgi-bin/pythonscript.py?type=ball&color=blue

My first question is how do I read in those parameters (type=ball and color=blue) in the python script? Would using any of these methods work:

    parameters=input() 

    or

    parameters=sys.argv[1:]

    or

    import cgi
    parameters=cgi.FieldStorage()

My second question is then how to I send data back to the JavaScript code. Now, I will be sending text back using JSONP (JavaScript uses callback). Will a simple print or return statement work as shown below?

    output_text='callback_func('+json.dump(output_info)+');'

    print(output_text)

    or

    return output_text

Thanks for the help!!! It is really appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:06:57+00:00Added an answer on June 16, 2026 at 7:06 am

    If you’re using the cgi module, then you use FieldStorage and print output

    Taken from http://docs.python.org/2/library/cgi.html – this can be used as a base that you just tweak slightly…

    import cgi
    
    print "Content-Type: text/html"     # HTML is following
    print                               # blank line, end of headers
    print "<TITLE>CGI script output</TITLE>"
    print "<H1>This is my first CGI script</H1>"
    
    form = cgi.FieldStorage()
    if "name" not in form or "addr" not in form:
        print "<H1>Error</H1>"
        print "Please fill in the name and addr fields."
        return
    print "<p>name:", form["name"].value
    print "<p>addr:", form["addr"].value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net website which contains a Thread that fetches some data from
I currently have a website source code (no control over the source) which contains
I have a listbox on my website, which contains some elements. I made the
i have a website page that contains only data of which one field gives
I have a dashboard in my website which contain some entries in table, each
I have some xml files that contain text, which are displayed on my website.
I have a website which contains a large (and wide) table. The table is
I have a website which using active directory authorization on a windows server in
Basically, I have a class defined in my website which contains a bunch of
I have an asp.net website which contains a few pages that I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.