Hey all. I am a python programmer. I run a blog aggregator. I am not a
javascript programmer, but I'm pushing my way through the turbogears
book. It's given me a pile of ideas for new pieces regarding my sites.
Rather than using TG for the saskblogs stuff, I decided to just use
Mochikit.
I have a python json-rpc service that I'm serving via Apache. I've
tested it with jsonrpclib and it works.
import jsonrpclib
s=jsonrpclib.ServerProxy("http://saskblogstest.catprint.ca/services/
search.py")
s.search("Test")
returns a json object from the search method via mod_python and
jsonrpc.apacheServiceHandler.
My problem is getting Mochikit to connect to the service. I use
firebug to do javascript testing in it's console. I just can't seem to
get the javascript to connect and I'm at a loss.
I've tried doXHR(), loadJSONDoc and doSimpleXMLHttpRequest() and it
fails to connect. I figure I'm not using the correct syntax, but I
really don't know. What would be the proper syntax to send the string
"test" to the method "search" in the jsonrpc service?
The most recent tests I've tried are:
var d = doXHR('http://saskblogstest.catprint.ca/services/search.py',
{method:"post", querystring:
"method=search&searchvalue="+searchterm});
var d = doSimpleXMLHttpRequest('http://saskblogstest.catprint.ca/
services/search.py', {"searchvalue": searchterm});
var d = loadJSONDoc('http://saskblogstest.catprint.ca/services/
search.py', {"method=search&searchvalue="+searchterm});
I've added a simple alert callback to all of those to see if anything
comes out, I've added logging to the python service. I get "undefined"
in the alert, and nothing in the python logging, which is why I
expect it isn't querying the service.
If anyone has a suggestion, I'm all ears.
Thanks,
lance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---