Hi,
I need help in the following issue.
JavaScript AJAX Call:
*****************************************************************
$.ajax({
type: "POST",
url: mw.config.apiBase +
"export_csv",
contentType: "application/json;
charset=utf-8",
data: {'obj':'test data'},<This can
be huge json data i want to pass>
dataType: "json",
success: function(response) {
alert(response)
}
});
******************************************************************
Python code snippet:
********************************************************************
# General Imports
import csv, sys, os, tempfile
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect
from mapfish.protocol import create_default_filter
from mapfish.decorators import MapFishEncoder, geojsonify, _jsonify
# Local imports
from myworldapp.lib.simple_controller import SimpleController
from myworldapp.model.meta import Session
from myworldapp.lib.myw_authorizer import MywAuthorizer
class ExportCsvController( SimpleController ):
readonly = False # if set to True, only GET is supported
def __init__(self):
SimpleController.__init__( self )
#
# Build an authorizer to authorize transactions.
#
self.authorizer = MywAuthorizer( session, False )
@geojsonify
def index( self):
#
# GET /: return all features.
#
if not self.authorizer.isRequestAuthorized( request ):
abort( 403)
<How to read data sent from the AJAX>
********************************************************************
Now I want read the sent data(data: {'obj':'test data'}) from AJAX in
index method of python code
Please help me in resolving the issue
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.