Sure! Now it works just fine, thanks

воскресенье, 4 сентября 2016 г., 18:33:33 UTC+3 пользователь Stefan Adams 
написал:
>
> I think the main issue is that you're trying to send a JSON object, not a 
> JSON string.  You can't send objects via HTTP, you have to stringify the 
> object.
>
>         $.ajax({
>             type: 'POST',
>             url: '/',
>             data: JSON.stringify({ 'formdata': 'abc' }),
>         }).done(function(data){console.log(data)});
>
> On Sun, Sep 4, 2016 at 7:31 AM, Alex Povolotsky <[email protected] 
> <javascript:>> wrote:
>
>> Hello
>>
>> I'm trying fairly simple code
>>
>>         $.ajax({
>>             type: 'POST',
>>             url: fd_url,
>>             dataType: 'json',
>>             data: { 'formdata': config },
>>             accepts: { 'json': 'application/json' }
>>         }).done(
>>             function ( data ) {
>>                 alert(data.status);
>>             }
>>         );
>>
>> POST goes ok, but no parameter can be seen!
>>
>> All I have is an asset in request.
>>
>> Tried both $self->param( 'formdata' ) and $self->req->json, tried 
>> different Content-Type.
>>
>> What am I doing wrong?
>>
>> config is an object, I'm expecting to store it in database as json...
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mojolicious" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/mojolicious.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to