hello,
I am trying to send post data with JSON. But have failed.

It doesn't send the post data. What am I doing wrong? Also, how do I
get what my controller returns?

Here is my javascript function:

function savePage(){
    var req = getXMLHttpRequest()
    req.open('POST','/savepage?tg_format=json',true)
    var postdata = "data="+getJPBdata()
    var d = sendXMLHttpRequest(req, postdata)

    var saveingPage = function (result) {
        alert(result['status']);
    }
    var savePageFailed = function (err) {
        alert("Failed to connect");
    }
    d.addCallbacks(saveingPage, savePageFailed);
}


and here is my controller:

    @expose(format="json")
    def savepage(self, data=None):
        if data:
            status = "Success!"
        else:
            status = "Failed!"
        return dict(saveingstatus=status)



Any help would be great!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to