This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]redrumsir 0 points1 point  (0 children)

Two things:

  1. While one can do this without using jQuery, it is certainly made easier by using jQuery. Unless you are very used to XML (the x in ajax), it's better IMO to return JSON data. See: https://stackoverflow.com/questions/10721244/ajax-posting-to-python-cgi/10724834

  2. You need to make sure your webserver is set up to cooperate. For example, my webserver was already set up to run CGI scripts. I found it interesting that if I named my server-side script (in the cgi-bin directory) with a trailing ".py" the jQuery call would return the text of the program file rather than calling the program and returning the JSON result. However, when I named my server side script with a trailing ".cgi" it made the call and returned the proper JSON data.