This is a migrated thread and some comments may be shown as answers.

Kendo UI DataSource / JSON Issue

1 Answer 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Veteran
Richard asked on 10 Aug 2013, 03:17 PM
Sorry for the cross-posting but going crazy on this one.

http://stackoverflow.com/questions/18151901/kendoui-datasource-results-in-invalid-json-primitive

So essentially, when I use a Kendo Data Source and send anything in the data: field as part of the transport/read command this is what I see come across in fiddler in the json request.

0=%7B&1='&2=s&3=U&4=s&5=e&6=r&7=n&8=a&9=m&10=e&11='&12=%3A&13='&14=a&15=d&16=m&17=i&18=n&19=%40&20=m&21=a&22=i&23=l&24=.&25=c&26=o&27=m&28='&29=%2C&30='&31=s&32=P&33=a&34=s&35=s&36=w&37=o&38=r&39=d&40='&41=%3A&42='&43=1&44=3&45=1&46=2&47=3&48='&49=%2C&50='&51=s&52=U&53=s&54=e&55=r&56=I&57=D&58='&59=%3A&60='&61=1&62=5&63=3&64=9&65='&66=%2C&67='&68=s&69=C&70=l&71=u&72=b&73=I&74=D&75='&76=%3A&77='&78=1&79='&80=%7D

If I don't use the Kendo Data Source and just a common ajax request I don't see these problems at all.  Just curious if anyone has seen this before.  I must be doing something stupid.

Thanks,

Richard

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
Veteran
answered on 11 Aug 2013, 04:26 PM
I figured it out after playing around with it for a while.  I found this works.  So putting the more traditional and working $.ajax request into the read function all was perfect.

transport: {
                    read: function(options) {
                        $.ajax({
                            type: "POST",
                            url: "http://sdk.domain.com/services/general.asmx/GetPendingActions",
                            data:  "{'sUsername':'admin@mail.com','sPassword':'13123','sUserID':'1539','sClubID':'1'}",
                            contentType: "application/json; charset=utf-8",
                            dataType: "json",
                            success: function (result) {
                                options.success(result);
                            }
                        });
                    }
                },
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Veteran
Answers by
Richard
Top achievements
Rank 1
Veteran
Share this question
or