Madhu, It looks like the data being sent via xhr is in an improper
format. According to the javascript you provided, data should be a
urlencoded string. If you send the string
'username=python&password=pylons' as data, you should be able to
access the value of username via request.params['username'], and the
value of password via request.params['password']
On Nov 6, 3:35 am, Alagu Madhu <[EMAIL PROTECTED]> wrote:
> Hi
>
> JSONRequest = {
> post: function( url, data, callback, timeout ) {
> xhr = new XMLHttpRequest();
> xhr.open("POST", url, true);
> xhr.setRequestHeader( "Content-Type", "application/x-www-form-
> urlencoded" );
> if (callback) {
> xhr.onreadystatechange = function() {
> if( xhr.readyState==4 ) {
> //alert( xhr.responseText );
> callback( xhr.responseText );
> }
> }
> }
> if ( data ) {
> xhr.send( data );
> } else {
> xhr.send( null );
> }
> },
> get: function(url, callback) {
> alert( 'in JSONRequest.get();' );
> }
>
> };
>
> using above code(js) I send the
> data(login={username:"python",password:"pylons") to pylons.
>
> ... pylons controller...
>
> print request.params.keys()
> print request.params.items()
> print request.params.values()
>
> I am getting flowing output...
>
> ['login']
> [('login', u'{username:"python", password:"
> [u'{username:"python", password:"pylons"}']
>
> How can I get the username & password value ?
>
> Thanks
>
> Madhu Alagu
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---